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 x[]=new int[n]; int y[]=new int[n]; for(int a0 = 0; a0 < n; a0++){ x[a0] = in.nextInt(); y[a0] = in.nextInt(); } int f1=0; int f2=0; for(int a0 = 1; a0 < n; a0++){ if(x[a0]!=x[a0-1]) f1=1; if(y[a0]!=y[a0-1]) f2=1; } if(f1==0|| f2==0) System.out.println("YES"); else System.out.println("NO"); } }