import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void main(String[] args) throws IOException { BufferedReader scanner = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(scanner.readLine()); int[] x = new int[n]; int[] y = new int[n]; int i = 0; while (n-- != 0) { String[] line = scanner.readLine().split(" "); x[i] = Integer.parseInt(line[0]); y[i] = Integer.parseInt(line[1]); i++; } int count = 0; int sample = x[0]; for (int j = 1; j < x.length; j++) { if(sample != x[j]) { count = 1; break; } } if(count != 0) { sample = y[0]; for (int j = 1; j < y.length; j++) { if(sample != y[j]) { count = 2; break; } } } if(count != 2) System.out.println("YES"); else System.out.println("NO"); } }