//vivekmufc #include #include using namespace std; typedef long long ll; typedef pair ii; #define pb(x) push_back(x) #define endl '\n' #define INF (int)1e9 int mod = 1000000007; #define N 100005 int main() { std::ios::sync_with_stdio(false); int n; cin>>n; set st; int flg1 = 1, flg2 = 1; int x,y; cin>>x>>y; for (int i = 0; i < n-1; ++i) { int a,b; cin>>a>>b; if(a!=x) flg1 = 0; if(b!=y) flg2 = 0; } if(flg1 || flg2) cout<<"YES"; else cout<<"NO"; }