#include "bits/stdc++.h" using namespace std; #define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i)) #define rer(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i)) #define reu(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i)) static const int INF = 0x3f3f3f3f; static const long long INFL = 0x3f3f3f3f3f3f3f3fLL; typedef vector vi; typedef pair pii; typedef vector > vpii; typedef long long ll; template static void amin(T &x, U y) { if(y < x) x = y; } template static void amax(T &x, U y) { if(x < y) x = y; } int main() { int n; while(~scanf("%d", &n)) { vector x(n); vector y(n); for(int i = 0; i < n; ++ i) scanf("%d%d", &x[i], &y[i]); bool ans = false; ans |= count(x.begin(), x.end(), x[0]) == n; ans |= count(y.begin(), y.end(), y[0]) == n; puts(ans ? "YES" : "NO"); } return 0; }