# Enter your code here. Read input from STDIN. Print output to STDOUT q = int(raw_input()) for i in range(q): onEdge = "NO" maxx,maxy = 0,0 listx,listy=[],[] n = int(raw_input()) for j in range(n): x,y = map(int,raw_input().strip().split(' ')) listx.append(x) listy.append(y) if (x >0 ) and (y >0) : if x < maxx : break if y < maxy : break maxx = max(listx) maxy = max(listy) if j == n-1 : onEdge = "YES" print onEdge