#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; int main(){ int n,xx,yy; bool x_flag,y_flag; cin >> n; for(int a0 = 0; a0 < n; a0++){ int x; int y; cin >> x >> y; if(a0==0){ xx=x; yy=y; x_flag=true; y_flag=true; } if(x_flag && xx!=x) x_flag=false; if(y_flag && yy!=y) y_flag=false; } if(x_flag || y_flag) printf("YES"); else printf("NO"); return 0; }