# Enter your code here. Read input from STDIN. Print output to STDOUT def isOnSq(ptList): xMin = ptList[0][0] xMax = ptList[0][0] yMin = ptList[0][1] yMax = ptList[0][1] result = True response = "YES" for pt in ptList: x,y = pt if x < xMin: xMin = x if x > xMax: xMax = x if y < yMin: yMin = y if y > yMax: yMax = y for pt in ptList: x,y = pt if x != xMin and x != xMax and y != yMin and y != yMax: result = False break if not result: response = "NO" return response Q = int(raw_input()) for qi in xrange(Q): N = int(raw_input()) pts = [] for pti in xrange(N): x,y = [int(i) for i in raw_input().split()] pts.append((x,y)) print(isOnSq(pts))