#include using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(0); int n, i=0; cin >> n; int a, b, c_1=1, c_2=1; cin >> a >> b; for (int j=0; j> c >> d; if (a==c) c_1++; if (b==d) c_2++; } if (c_1==n || c_2==n) cout << "YES" << endl; else cout << "NO" << endl; return 0; }