#include struct point{ int x; int y; }; typedef struct point Point; int main(){ int n; scanf("%d",&n); Point p[n]; int i,flag1=1,flag2=1; for(i = 0; i < n; i++){ scanf("%d %d",&p[i].x,&p[i].y); } int j,t=p[0].x; for(j = 0; j < n; j++){ if(p[j].x != t){ flag1 = 0; break;} } int t1 = p[0].y; for(j = 0; j < n; j++){ if(p[j].y != t1){ flag2 = 0; break; } } if(flag1 == 1){ printf("YES"); } else if(flag2 == 1){ printf("YES"); } else{ printf("NO"); } return 0; }