import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { public static void main(String[] args) { Scanner in = new Scanner(System.in); int q = in.nextInt(); int x,y,n,x1,y1; boolean flag = true; for( ; q>0 ; q--) { x=0; y=0; x1=0; y1=0; n = in.nextInt(); flag = true; int a[][] = new int[n][2]; int i=0; for(i=0 ; ix || a[i][1]>y) { flag = false; break; } else if(a[i][0]