#include #define up(j,k,i) for(i=j;ik;i--) #define M 1000000007 #define pp(n) printf("%lld\n",ll(n)) #define ps(n) printf("%lld ",ll(n)) #define pd(x,y) printf("%lld %lld\n",ll(x),ll(y)) #define is(n) scanf("%lld",&n) #define max(x,y) max(ll(x),ll(y)) #define min(x,y) min(ll(x),ll(y)) #define inf LLONG_MAX #define id(n,m) scanf("%lld%lld",&n,&m) #define it(n,m,k) scanf("%lld%lld%lld",&n,&m,&k) #define ss(s) scanf("%s",s) #define cool 0 #define pb push_back #define mp make_pair #define F first #define S second #define pll pair #define db cout<<"######\n" #define null(a) memset(a,0,sizeof(a)) #define neg(a) memset(a,255,sizeof(a)) typedef long double ld; typedef long long int ll; using namespace std; ll i,j,k,z,t,n,m,sum,ans,x,y,maxm=0,minm=inf,l; set sx,sy; vector vx,vy; pll a[15]; bool check(ll x0,ll x1,ll y0,ll y1) { ll i; if(x1=y0 and a[i].S<=y1) continue; else if(a[i].F==x0 and a[i].S>=y0 and a[i].S<=y1) continue; else if(a[i].S==y1 and a[i].F>=x0 and a[i].F<=x1) continue; else if(a[i].S==y0 and a[i].F>=x0 and a[i].F<=x1) continue; else return false; } return true; } int main() { is(t); while(t--) { bool flag=false; is(n); up(0,n,i) { id(a[i].F,a[i].S); vx.pb(a[i].F); vy.pb(a[i].S); } up(0,vx.size(),i) up(0,vx.size(),j) up(0,vy.size(),k) up(0,vy.size(),l) if(check(vx[i],vx[j],vy[k],vy[l])) flag=true; if(flag) puts("YES"); else puts("NO"); } }