#include using namespace std; typedef long long ll; typedef pair pii; typedef vector vi; #ifndef ONLINE_JUDGE #define dbg(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl; #else #define dbg(x) #endif #define ff first #define ss second int main(){ std::ios_base::sync_with_stdio(false); int n; cin >> n; map mx, my; for (int i = 0; i < n; i++){ int x, y; cin >> x >> y; mx[x]++; my[y]++; } if ((int) mx.size() == 1 || (int) my.size() == 1) cout << "YES" << endl; else cout << "NO" << endl; return 0; }