import java.io.*; import java.util.*; public class Solution { public static void main(String[] args) { /* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */ Scanner sc=new Scanner(System.in); int q=sc.nextInt(); int n; int flag=1; int x,y,mx1=99999,mx2=99999,my1=99999,my2=99999,tx,ty; for(int i=1;i<=q;i++) { flag=1; n=sc.nextInt(); if(n==1) { x=sc.nextInt(); y=sc.nextInt(); flag=1; } else if(n>1) { for(int j=1;j<=n;j++) { if(j==1) { mx1=sc.nextInt(); my1=sc.nextInt(); } else if(j==2) { tx=sc.nextInt(); ty=sc.nextInt(); if(mx1!=tx) { mx2=tx; } if(my1!=ty) { my2=ty; } } else { tx=sc.nextInt(); ty=sc.nextInt(); if(mx1==99999) mx1=tx; else if(mx2==99999) mx2=tx; if(my1==99999) my1=ty; else if(my2==99999) my2=ty; if((tx==mx1 || tx==mx2) && (ty<=Math.max(my1,my2) && ty>=Math.min(my1,my2))); if((ty==my1 || ty==my2) && (tx<=Math.max(mx1,mx2) && tx>=Math.min(mx1,mx2))); else flag=0; } } } if(flag==1) System.out.println("YES"); else System.out.println("NO"); } } }