n = int(input()) for _ in range(n): q = int(input()) points = [] for __ in range(q): points.append([int(x) for x in input().split()]) ans = True if len(points) <= 3: ans = True else: min_x = points[0][0] max_x = points[0][0] min_y = points[0][1] max_y = points[0][1] for i in range(q): if min_x > points[i][0]: min_x = points[i][0] if min_y > points[i][1]: min_y = points[i][1] if max_x < points[i][0]: max_x = points[i][0] if max_y < points[i][1]: max_y = points[i][1] for i in range(q): x, y = points[i] if x not in [min_x, max_x] and y not in [min_y, max_y]: ans = False break if ans: print("YES") else: print("NO")