import java.io.*; import java.util.*; public class Solution { static class Line{ Point p[] = new Point[10]; int pi = 0; int ish; int isv; public void reset(){ pi = 0; ish = 0; isv = 0; } public Point getMinMaxX(){ int min = Integer.MAX_VALUE; int max = Integer.MIN_VALUE; for( int i = 0; i < pi; i++ ){ if( p[i].x > max ) max = p[i].x; if( p[i].x < min ) min = p[i].x; } return new Point( min, max ); } public Point getMinMaxY(){ int min = Integer.MAX_VALUE; int max = Integer.MIN_VALUE; for( int i = 0; i < pi; i++ ){ if( p[i].y > max ) max = p[i].y; if( p[i].y < min ) min = p[i].y; } return new Point( min, max ); } } static class Point{ int x,y; Point(int a, int b){ x=a; y=b; } } public static int pInLine( Point x, Line L ){ if( L.pi == 0 ){ L.p[L.pi] = x; return 1; } if( L.pi == 1 ){ if( x.x == L.p[L.pi].x ){ //horizontal L.ish = 1; L.p[L.pi++] = x; return 1; }else if( x.y == L.p[L.pi].y ){ //vertical L.isv = 1; L.p[L.pi++] = x; return 1; } return 0; } if( L.isv == 1 ){ if( x.y == L.p[0].y ){ L.p[L.pi++] = x; return 1; } }else{ if( x.x == L.p[0].x ){ L.p[L.pi++] = x; return 1; } } return 0; } public static void main(String[] args) { Scanner in = new Scanner(System.in); int Q = in.nextInt(); for( int qi = 0; qi < Q; qi++){ int N = in.nextInt(); Point L[] = new Point[N]; int tx,ty,bx,by; tx = bx = in.nextInt(); ty = by = in.nextInt(); L[0] = new Point(tx,ty); for( int i = 1; i < N; i++){ int x = in.nextInt(); int y = in.nextInt(); L[i] = new Point(x,y); if( tx > x ) tx = x; if( ty > y ) ty = y; if( bx < x ) bx = x; if( by < y ) by = y; } if( N < 3 ) { System.out.println("YES"); continue; } boolean no = false; for( Point p : L ){ if( p.x == tx ){ if((p.y < ty)||(p.y>by)){ System.out.println("NO"); no = true; break; } }else if( p.x == bx ){ if((p.y < ty)||(p.y>by)){ System.out.println("NO"); no = true; break; } }else if( p.y == ty ){ if((p.x < tx)||(p.x>bx)){ System.out.println("NO"); no = true; break; } }else if( p.y == by ){ if((p.x < tx)||(p.x>bx)){ System.out.println("NO"); no = true; break; } }else{ System.out.println("NO"); no = true; break; } } if( no ) continue; System.out.println("YES"); } } }