import java.util.Scanner; public class Solution { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int x[] = new int[n]; int y[] = new int[n]; int i; for(i = 0; i < n; i++) { x[i] = sc.nextInt(); y[i] = sc.nextInt(); } int a = x[0]; int b = y[0]; int c = 0, d= 0; for(i = 1; i < n;i++) { if(x[i] != a) c = 1; if(y[i] != b) d = 1; } if(c == 0 || d == 0) System.out.println("YES"); else System.out.println("NO"); } }