#include #include #include #include #include using namespace std; typedef unsigned long long ull; typedef long long ll; typedef unsigned long ul; typedef __int128 lll; template inline T qAbs(const T &t) { return t >= 0 ? t : -t; } int main() { int T, x, y, c; bool h = true, v = true; cin >> T; cin >> x >> y; while (--T) { cin >> c; if (c != x) v = false; cin >> c; if (c != y) h = false; } cout << ((h || v) ? "YES" : "NO") << endl; return 0; }