import java.io.*; import java.util.*; public class Solution { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while(t-->0){ int n = sc.nextInt(); if(n==1 || n==2) System.out.println("YES"); else{ int max_x = Integer.MIN_VALUE; int max_y = Integer.MIN_VALUE; int min_x = Integer.MAX_VALUE; int min_y = Integer.MAX_VALUE; int x[] = new int[n]; int y[] = new int[n]; for(int i=0;imax_x) max_x = x[i]; if(x[i]max_y) max_y= y[i]; if(y[i]