import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int[] xArr = new int[n]; int[] yArr = new int[n]; for(int a0 = 0; a0 < n; a0++){ int x = in.nextInt(); int y = in.nextInt(); xArr[a0] = x; yArr[a0] = y; } boolean xSame = true; boolean ySame = true; for(int i = 1; i < n; i++){ if(xArr[i] != xArr[i-1]){ xSame = false; break; } } for(int j = 1; j < n; j++){ if(yArr[j] != yArr[j-1]){ ySame = false; break; } } if((xSame && !ySame) || (!xSame && ySame)) System.out.println("YES"); else System.out.println("NO"); } }