# Enter your code here. Read input from STDIN. Print output to STDOUT q = input() for i in range(q): z = input() _x = [] _y = [] for j in range(z): x, y = map(int, raw_input().split()) _x.append(x) _y.append(y) check = False for a,b in zip(_x, _y): if min(_x) < a < max(_x) and min(_y) < b < max(_y): print "NO" check = True break if not check: print "YES"