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(); boolean flag1= true; boolean flag2 = true; 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(); } for(int i = 0; i < n - 1; i++) { if(x[i] != x[i + 1]) flag1 = false; } for(int i = 0; i < n - 1; i++) { if(y[i] != y[i + 1]) flag2 = false; } if((flag1 && !flag2) || (!flag1 && flag2)) System.out.print("YES"); else System.out.print("NO"); } }