#include using namespace std; #define LL long long #define ULL unsigned long long #define MOD 1000000007 #define TR(it,container) for(auto it=container.begin();it!=container.end();++it) #define DB(x) cout<<#x<<"="<=x;--i) #define ALL(container) container.begin(),container.end() #define endl "\n" int main(){ ios::sync_with_stdio(false); cin.tie(NULL); #ifdef LOCAL_MACHINE freopen("input.txt","r",stdin); //freopen("output.txt","w",stdout); #endif // LOCAL_MACHINE int n,x,y,temp; cin>>n; int arr1[n],arr2[n]; FOR(i,0,n-1){ cin>>arr1[i]>>arr2[i]; } sort(arr1,arr1+n); sort(arr2,arr2+n); if(arr1[0]==arr1[n-1]||arr2[0]==arr2[n-1]) cout<<"YES"; else cout<<"NO"; }