import java.io.*; import java.util.*; /** * * @author Sourav Kumar Paul */ class SolveB { public static void main(String[] args) throws IOException{ Reader in = new Reader(new InputStreamReader(System.in)); PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out)); int q = in.nextInt(); while(q-->0) { int n = in.nextInt(); int x[] = new int[n]; int y[] = new int[n]; int minx = Integer.MAX_VALUE; int miny = minx; int maxx = Integer.MIN_VALUE; int maxy = maxx; for(int i=0; i=miny && y[i] <=maxy) ; else { out.println(x[i]+" "+y[i]); fa = true; } } else if((y[i] == miny) || (y[i] == maxy)) { if(x[i]>=minx && x[i] <=maxx) ; else { //out.println(x[i]+" "+y[i]); fa = true; } } else { //out.println(x[i]+" "+y[i]); fa = true; } } if(!fa) out.println("YES"); else out.println("NO"); } out.flush(); out.close(); } public static class Reader { public BufferedReader reader; public StringTokenizer st; public Reader(InputStreamReader stream) { reader = new BufferedReader(stream); st = null; } public String next() { while (st == null || !st.hasMoreTokens()) { try { st = new StringTokenizer(reader.readLine()); } catch (IOException e) { throw new RuntimeException(e); } } return st.nextToken(); } public int nextInt() { return Integer.parseInt(next()); } public String nextLine() throws IOException{ return reader.readLine(); } public long nextLong(){ return Long.parseLong(next()); } public double nextDouble(){ return Double.parseDouble(next()); } } }