#include using namespace std; #define ll long long #define pb push_back int main() {ll n,n1; cin>>n; n1=n; ll x,y,countx=1,county=1; cin>>x>>y; --n; while(n--) { ll x2,y2; cin>>x2>>y2; if(x==x2) { countx++; } else if(y==y2) { county++; } } if(countx==n1 || county==n1) { cout<<"YES"; } else { cout<<"NO"; } }