import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.util.Arrays; import java.util.HashSet; public class Solution{ static InputStream is; private static byte[] inbuf = new byte[1024]; static int lenbuf = 0, ptrbuf = 0; static String INPUT = ""; public static void main(String args[]) throws IOException { is = INPUT.isEmpty() ? System.in : new ByteArrayInputStream(INPUT.getBytes()); java.io.PrintWriter out = new java.io.PrintWriter(System.out); int q = ni(); int n; int a[][]; boolean counter; boolean flag; while(q-- > 0) { flag = true; n = ni(); int x,y,lx = -100000,mx = 100000; int ly = -100000,my = 100000; counter = true; int array[][]= new int[n][2]; for (int i =0 ;i lx ) lx = array[i][0]; if (array[i][1] > ly) ly = array[i][1]; if (array[i][0] < mx ) mx = array[i][0]; if (array[i][1] < my) my = array[i][1]; } for (int i =0 ;i (ly) && (y) < (my)) flag = false; } } if(flag) { out.println("YES"); }else { out.println("NO"); } } out.close(); } private static int ni() { int num = 0, b; boolean minus = false; while((b = readByte()) != -1 && !((b >= '0' && b <= '9')|| b == '-')); if(b == '-'){ minus = true; b = readByte(); } while(true){ if(b >= '0' && b <= '9'){ num = num * 10 + (b - '0'); }else{ return minus ? -num : num; } b = readByte(); } } private static long ln() { long num = 0, b; boolean minus = false; while((b = readByte()) != -1 && !((b >= '0' && b <= '9')|| b == '-')); if(b == '-'){ minus = true; b = readByte(); } while(true){ if(b >= '0' && b <= '9'){ num = num * 10 + (b - '0'); }else{ return minus ? -num : num; } b = readByte(); } } private static String str() { StringBuffer num=new StringBuffer() ; int b; while((b = readByte()) != -1 && !((b >= '0' && b <= '9')|| b == '.'|| b == '-'||(b >= 'a' && b <= 'z'))); while(true){ if(b >= '0' && b <= '9'|| b == '.'|| b == '-'||(b >= 'a' && b <= 'z')){ num=num.append((char)b); }else{ return num.toString(); } b = readByte(); } } private static int readByte() { if(ptrbuf >= lenbuf){ ptrbuf = 0; try { lenbuf = is.read(inbuf); } catch (IOException e) { } if(lenbuf <= 0)return -1; } return inbuf[ptrbuf++]; } }