# Enter your code here. Read input from STDIN. Print output to STDOUT import sys LINES = sys.stdin.readlines() Q = int(LINES[0]) cur_line = 1 def solve(pts): xmi = 100000 xma = -100000 ymi = 100000 yma = -100000 for (x,y) in pts: xmi = min(xmi, x) xma = max(xma, x) ymi = min(ymi, y) yma = max(yma, y) #print for (x,y) in pts: #print (x,y), xmi,xma,ymi,yma #print "(%s == %s or %s == %s)" % (x,xmi,x,xma) #print "(%s == %s or %s == %s)" % (y,ymi,y,yma) if (x == xmi or x == xma): continue if (y == ymi or y == yma): continue return False return True for q in xrange(Q): N = int(LINES[cur_line]) cur_line += 1 pts = [] for n in xrange(N): x,y = map(int, LINES[cur_line].split()) cur_line += 1 pts.append((x,y)) print "YES" if solve(pts) else "NO"