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 xstart=0; int ystart=0; int flagx=1; int flagy=1; for(int i = 0; i < n; i++){ int x = in.nextInt(); int y = in.nextInt(); if(i==0){ xstart = x; ystart = y; }else{ if(x!=xstart){ flagx=0; }if(y!=ystart){ flagy=0; } } } if(flagx==1 || flagy==1){ System.out.println("YES"); }else{ System.out.println("NO"); } } }