#include using namespace std; int main() { int n; cin >> n; vector > a(n); bool ans1 = true, ans2 = true; for (int i = 0; i < n; ++i) { cin >> a[i].first >> a[i].second; if (i == 0) continue; ans1 &= a[i].first == a[i - 1].first; ans2 &= a[i].second == a[i - 1].second; } cout << (ans1 || ans2 ? "YES" : "NO") << "\n"; return 0; }