q = int(input().strip()) while q > 0: n = int(input().strip()) plusPetitX = float('inf') plusPetitY = float('inf') plusGrandX = -float('inf') plusGrandY = -float('inf') l = [] possible = True for n0 in range(n): x,y = [int(i) for i in input().strip().split(" ")] if x < plusPetitX : plusPetitX = x if x > plusGrandX : plusGrandX = x if y < plusPetitY: plusPetitY = y if y > plusGrandY: plusGrandY = y l.append((x,y)) for pair in l: if (pair[0] != plusPetitX and pair[0] != plusGrandX) and pair[1] != plusPetitY and pair[1] != plusGrandY: possible = False break if possible: print("YES") else: print("NO") q -= 1