import sys input = sys.stdin.readline N=int(input()) for i in range(N): x1,x2,x3,y1,y2,y3=map(int,input().split()) if y1==y2 and x1==x2: print("NO") continue if y1==y3 and x1==x3: print("NO") continue if y2==y3 and x2==x3: print("NO") continue A=[]# x1c: a,b=C c,d=A if b>=c: print("YES") continue if B!=[] and D!=[]: a,b=B c,d=D if a>c: a,b=D c,d=B if b>=c: print("YES") continue print("NO")