# Enter your code here. Read input from STDIN. Print output to STDOUT def check(arr): d = sorted(arr) first = [] last = [] two = [] x = d[0][0] #first.append(x) y = d[len(d)-1][0] #last.append(y) for i in range(len(d)): if d[i][0]==x: first.append(d[i][1]) elif d[i][0]==y: last.append(d[i][1]) else: #print 'lo' if len(two)<2: if d[i][1] not in two: two.append(d[i][1]) if len(two)==2: if d[i][1] not in two: return 'NO' #print two #print last #print first if len(two)<1: return 'YES' elif(len(two))==1: for i in range(len(first)-1): if( (two[0]-first[i])*(two[0]-first[i+1])<0): return 'NO' for i in range(len(last)-1): if( (two[0]-last[i])*(two[0]-last[i+1])<0): return 'NO' for i in range(len(last)): for j in range(len(first)): if(two[0]-last[i])*(two[0]-first[j])<0: return 'NO' else: for i in first: if i>max(two): return 'NO' if imax(two): return 'NO' if i0: q = int(input()) arr = [] while q>0: x,y = [int(x) for x in raw_input().split()] arr.append([x,y]) q-=1 print check(arr) t-=1