#include #define LL long long #define LD long double #define x first #define y second #define NL cout<::iterator it=a.begin();it!=a.end();++it)cout<<*it<<" "; #define print(a,n) for(int f=0;f struct sort_pair_second { bool operator()(const pair &left, const pair &right) { if(left.second < right.second) return left.second < right.second; else if(left.second == right.second) return left.first < right.first; return false; } }; int main() { int n; cin >> n; int a,b,pa,pb; cin >> a >> b; cin >> pa >> pb; string ans="YES"; n-=2; if(pa == a){ while(n--){ cin >> a >> b; if(a!=pa){ ans = "NO"; break; } } }else if(pb == b){ while(n--){ cin >> a >> b; if(b!=pb){ ans = "NO"; break; } } }else{ ans = "NO"; } cout << ans << endl; }