#include using namespace std; #define mp make_pair #define pb push_back #define FOR(i,a,n) for(i=a;i<=n;++i) #define RFOR(i,a,n) for(i=a;i>=n;--i) #define ll long long #define pll pair #define prr(a,b) pair< a , b > #define vec(t) vector< t > long long M = 1e9+7; const ll INF = LLONG_MAX; void build(long long init,long long l, long long r,ll* st,ll* ar, ll val, ll n) { if(l!=r) { build(2*init+1,l,(l+r)/2,st,ar,val,n); build(2*init+2,(l+r)/2+1,r,st,ar,val,n); st[init] = st[2*init+1]*st[2*init+2]; if(st[init]>=10){st[init]=st[init]/10;} //cout << st[init]<< " " << init << "yy\n"; } else { ll x = ar[l*val]; while(x>0) { st[init] = x; x = x/10; } } } void modify(long long init,long long l,long long r,long long ind,ll x,ll *st) { if(l!=r) { if(ind<=(l+r)/2) { modify(2*init+1,l,(l+r)/2,ind,x,st); } else { modify(2*init+2,(l+r)/2+1,r,ind,x,st); } st[init] = st[2*init+1]*st[2*init+2]; if(st[init]>=10){st[init]=st[init]/10;} } else { //cout << l << "mod\n"; while(x>0) { st[init] = x; x = x/10; } } } ll getans(ll *st) { return st[0]; /* if(rqr) { return; } ql = max(l,ql); qr = min(r,qr); if(l==ql && r==qr) { pll foo; foo.first = max((*ans).first,st[init].first); foo.second = 0; foo.second = (foo.second+(st[init].second)*(foo.first==(st[init].first)))%M; foo.second = (foo.second+((*ans).second)*(foo.first==((*ans).first)))%M; (*ans) = foo; cout << (*ans).second; return; } getans(2*init+1,l,(l+r)/2,ql,qr,ans,st,L); getans(2*init+2,(l+r)/2+1,r,ql,qr,ans,st,L); */ } long long power_2(long long p1,long long p2,ll x = M) { if(p2==0){return 1;} if(p2==1){return p1%x;} long long y = power_2(p1,p2/2,x); y = ((((y*y)%x)*power_2(p1,p2%2,x))%x); return y; } long long inv(long long p1){return power_2(p1,M-2);} long long fact(long long n) { ll i,nlt= 1; FOR(i,1,n) { nlt = (nlt*i)%M; } return nlt; } bool check_pr(ll x,vec(ll)* pr) { ll n = (*pr).size(); ll i; for(i = 0;i)* edges,bool *visited,ll *mx,ll dist,ll* vt) { visited[st] = true; set::iterator it; *vt = ((*mx>=dist)?(*vt):st); *mx = max(*mx,dist); set x1 = (*edges)[st]; for(it = x1.begin();it!=x1.end();++it) { if(!visited[*it]){fth((*it),edges,visited,mx,dist+1,vt);} } } void merge(ll* a, ll* b, ll* c,ll sz,ll x) { ll i,j; ll *d= new ll[x];fill(d,d+x,0); FOR(i,1,x) { FOR(j,1,x) { ll val = (((i-1)*power_2(10,sz,x))%x+(j-1))%x; d[val] = (d[val]+((a[(i-1)]*b[(j-1)])%M) )%M; } } FOR(i,1,x) { c[i-1] = (c[i-1]+d[i-1])%M; } } ll gcd(ll a,ll b) { if(a > b ) {return gcd(b,a);} if(a==b || a==0) { return b; } return gcd(b%a,a); } int getans_2(double x) { double fr = x-floor(x); int i = 1; //cout << fr << endl; while(true) { if(log10((double)(i+1))<=fr) { ++i; continue; } return i; } //return (int)(floor(pow(10,fr))); } bool ans = true; ll dfs(vec(set)* edges,ll* visited,ll* wish,ll* arr,ll h,ll st) { visited[st] = h; ll mx = 1e6; set::iterator it; //cout << st; set x1 = (*edges)[st]; for(it = x1.begin();it!=x1.end();++it) { if(visited[(*it)]==-1) { ll mx_wh = dfs(edges,visited,wish,arr,h+1,*it); mx = min(mx,mx_wh); } } //cout << st; if(mx> t1; double pi = 3.14159265359; a = 1e9*1e9; //cout << 8*a+1; ll sz = 1e5; /* ll *ans = new ll[sz]; double *ans_2 = new double[sz]; ll *arr = new ll[sz]; vec( vec(ll) ) divs(sz); fill(arr,arr+sz,1); */ /* ll **st = new ll*[sz]; FOR(i,1,sz) { ll sz_i = ((sz-1)/i)+1; st[i-1] = new ll[4*sz_i]; } */ sz = 1e2; /* ll* sg = new ll[sz+1]; vec(set ) vc(sz+1); sg[1] = 0; FOR(i,2,sz) { vc[i].insert(0); set::iterator it; ll val = 0; for(it = vc[i].begin();it!=vc[i].end();++it) { if(*it==val) { ++val; } else { break; } } sg[i] = val; //cout << val; for(j = 2*i;j<=sz;j = j+i) { vc[j].insert(sg[i]); } } */ //cin >> t1; while(t1-->0) { cin >> n; ll mxx=-11,mxy = -11,mix=11,miy = 11; FOR(i,1,n) { cin >> j >> k; mxx = max(mxx,j); mix = min(mix,j); mxy = max(mxy,k); miy = min(miy,k); } cout << (((mxx==mix)||(mxy==miy))?"YES":"NO") << endl; } return 0; }