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