#include #include #include #include #include using namespace std; int main() { /* Enter your code here. Read input from STDIN. Print output to STDOUT */ int n; cin >> n; int f = -1; int ans = 1; typedef pairpii; pii a,b; cin >> a.first >> a.second >> b.first >> b.second; if(a.first == b.first) f = 1; else if(a.second == b.second) f = 2; if(f == -1) ans = 0; for(int i = 0; i < n; i++) { cin >> a.first >> a.second; if(f==1 && a.first != b.first) ans = 0; if(f == 2 && a.second != b.second) ans = 0; } if(ans) cout << "YES" << endl; else cout << "NO" << endl; return 0; }