#include #include #include #include int mod(int x) { if(x>=0)return x; x*=(-1); return x; } int main() { /* Enter your code here. Read input from STDIN. Print output to STDOUT */ int t; scanf("%d",&t); while(t--) { int n;scanf("%d",&n); int x[n],y[n],i,j,k,l,g,f=0; for(i=0;iby ) { int t=ay; ay=by; by=t; } if(y[g]<=by && y[g]>=ay) {} else f=1; } else if(y[g]==ay || y[g]==by) { if(ax>bx ) { int t=ax; ax=bx; bx=t; } if(x[g]<=bx && x[g]>=ax) {} else f=1; } else f=1; } if(f==0) {i=j=k=l=n;} } } } } } if(f==0) printf("YES\n"); else printf("NO\n"); } return 0; }