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