#include using namespace std; int n, i, j, k, arr[100001]; string s, s1, s2; int main() { bool h = true, v = true; cin >> n; n = n-1; int i1, j1; cin >> i1 >> j1; while(n--) { cin >> i >> j; if(i != i1) h = false; if(j != j1) v = false; } if(h or v) cout << "YES"; else cout <<"NO"; return 0; }