import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; //import java.util.HashMap; import java.util.StringTokenizer; public class test { public static void main(String[] args) throws NumberFormatException, IOException{ PrintWriter pw= new PrintWriter(System.out); // StringBuffer buff=new StringBuffer(""); StringTokenizer token; BufferedReader in= new BufferedReader(new InputStreamReader(System.in)); int t=Integer.parseInt(in.readLine()); int n,minx=0, maxx=0,miny=0,maxy=0; int[] arra; int[] arrb; boolean bool=true; for (int i = 0; i < t; i++) { n=Integer.parseInt(in.readLine()); arra=new int[n]; arrb=new int[n]; for (int j = 0; j < n; j++) { token=new StringTokenizer(in.readLine()); arra[j]=Integer.parseInt(token.nextToken()); arrb[j]=Integer.parseInt(token.nextToken()); if(arra[j]maxx) maxx=arra[j]; if(arrb[j]>maxy) maxy=arrb[j]; } for (int j = 0; j < n; j++) { if(((arra[j]minx)) && ((arrb[j]miny))){ bool=false; break; } } if(bool==true) pw.println("YES"); else pw.println("NO"); } pw.flush(); pw.close(); } }