from collections import * from itertools import * from functools import * from heapq import * import sys,math input = sys.stdin.readline N = int(input()) eps = 0.000001 def answer(): x1,x2,x3,y1,y2,y3 = map(int,input().split()) X = [x1,x2,x3] Y = [y1,y2,y3] def eq(i,j): if Y[i]==Y[j]: if X[i]!=X[j]: return -1 else: return 1 return (X[i]-X[j])/(Y[j]-Y[i]) def check(t): Z = [X[i]+Y[i]*t for i in range(3)] if len(set(Z))!=3: return False if (min(Z)==Z[1])|(max(Z)==Z[1]): return True return False if check(0): print('YES') return for i in range(3): for j in range(3): t = eq(i,j) if t<0: continue if t==0: if check(eps): print('YES') return if (check(t+eps)|check(t-eps)): print('YES') return print('NO') return for _ in range(N): answer()