#include using namespace std; typedef long long ll; #define all(a) (a).begin(), (a).end() #define rall(a) (a).rbegin(), (a).rend() const double EPS = 1e-9; const ll INF = 1e17; int main() { ios::sync_with_stdio(0); cin.tie(nullptr); cout.tie(nullptr); int n, px, py; cin >> n >> px >> py; bool b1 = 1, b2 = 1; n--; while (n--) { int x, y; cin >> x >> y; if (x != px) b1 = 0; if (y != py) b2 = 0; px = x; py = y; } cout << (b1 || b2 ? "YES" : "NO") << "\n"; return 0; }