#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; int status = 0; cin >> n; int lastx; int lasty; bool flag = true; for(int a0 = 0; a0 < n; a0++){ int x; int y; cin >> x >> y; if(a0 == 0) { lastx = x; lasty = y; } else { if(flag && status==0) { if(lastx == x) { status |= 1; } if(lasty == y){ status |= 2; } flag = false; } if((status&1) && (lastx != x)) status &= 2; if((status&2) && (lasty != y)) status &= 1; } } if(status) cout << "YES\n"; else cout << "NO\n"; return 0; }