#include using namespace std; typedef long long LL; const int S = 100003; const int MOD = 1000000007; int _I(){int x; scanf("%d", &x); return x;} LL _LL(){LL x; scanf("%lld", &x); return x;} int dirX[]={1, 0, -1, 0, 1, -1, 1, -1}; int dirY[]={0, 1, 0, -1, 1, -1, -1, 1}; int rX[] = {1, 1, 2, 2, -1, -1, -2, -2}; int rY[] = {2, -2, 1, -1, 2, -2, 1, -1}; int Set(int N, int pos){return N=N|(1< M, N; void Do(){ int n = _I(); int mxx = -100, mxy = -100; int ans = 0; M.clear(), N.clear(); for(int i = 0; i < n; i++){ int x = _I(); int y = _I(); M[x]++; N[y]++; mxx = max(mxx, M[x]); mxy = max(mxy, N[y]); } if((mxy == n) || (mxx == n))ans = 1; if(ans)cout << "YES" << endl; else cout << "NO" << endl; } int main(){ Do(); return 0; }