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[] xs = new int[n]; int[] ys = new int[n]; for(int a0 = 0; a0 < n; a0++){ xs[a0] = in.nextInt(); ys[a0] = in.nextInt(); } boolean bx = true; for (int i = 1; i < n; i++) { if (xs[i] != xs[i-1]) { bx = false; } } boolean by = true; for (int i = 1; i < n; i++) { if (ys[i] != ys[i-1]) { by = false; } } if (bx || by) { System.out.println("YES"); } else { System.out.println("NO"); } } }