#include #define ll long long #define ld long double using namespace std; const int mod = 999983; pair a[15]; int main() { int n; cin >> n; for(int i = 0; i < n; ++i){ cin >> a[i].first >> a[i].second; } int allf = 1; int alls = 1; for(int i = 1; i < n; ++i){ if (a[i].first != a[i - 1].first) allf = 0; if (a[i].second != a[i - 1].second) alls = 0; } cout << (allf || alls? "YES": "NO") << '\n'; }