#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; #include #include #include using namespace std; int main() { int t; cin>>t; int x, y,x1,y1; cin>>x>>y; bool xflag=false; bool yflag=false; for(int i=1; i < t; i++) { cin>>x1>>y1; if (x1==x) xflag=true; else xflag=false; if (y1==y) yflag=true; else yflag=false; if (xflag==false && yflag==false) { cout<<"NO"; return 0; } } if (xflag|| yflag) cout<<"YES"; else cout<<"NO"; return 0; }