# Enter your code here. Read input from STDIN. Print output to STDOUT def degen(x,y): max_x = max(x) max_y = max(y) min_x = min(x) min_y = min(y) if (max_x == min_x) or (max_y == min_y): return 'YES' for ix in xrange(len(x)): top = y[ix] == max_y bottom = y[ix] == min_y left = x[ix] == min_x right = x[ix] == max_x if not(top) and not(bottom) and not(left) and not(right): # return 'NO' return 'YES' q = int(raw_input().strip()) for _ in xrange(q): n = int(raw_input().strip()) x, y = [], [] for ix in xrange(n): tx, ty = raw_input().strip().split(' ') tx, ty = [int(tx),int(ty)] x.append(tx) y.append(ty) print degen(x,y)