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