import java.io.*; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.Scanner; import java.util.StringTokenizer; public class code1 { public static void main(String[] agrs) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); sc.nextLine(); int[] x_cor = new int[21]; int[] y_cor = new int[21]; for (int i = 0; i < n; i++) { String[] s = sc.nextLine().split(" "); int x = Integer.parseInt(s[0]); int y = Integer.parseInt(s[1]); x += 10; y += 10; x_cor[x] += 1; y_cor[y] += 1; } int mx = -1, my = -1; for (int i = 0; i <= 20; i++) { if (mx < x_cor[i]) mx = x_cor[i]; if (my < y_cor[i]) my = y_cor[i]; } if (mx == n && my != n) { System.out.println("YES"); } else if (my == n && mx != n) { System.out.println("YES"); } else { System.out.println("NO"); } } // private class point implements Comparable { // int x, int y; // } }