import sys input = sys.stdin.readline T = int(input()) def solve(x1,y1,x2,y2,X1,Y1,X2,Y2): # 平行ならNo dx1 = X1-x1 dx2 = X2-x2 dy1 = Y1-y1 dy2 = Y2-y2 if dx1*dy2 - dx2*dy1 == 0: return False x2,y2,X1,Y1 = X1,Y1,x2,y2 return (X1-x1)*(x2-x1-(X2-X1)) > 0 and (Y1-y1)*(y2-y1-(Y2-Y1)) > 0 and (X1-x1)*((y2-y1) - (Y2-Y1)) == (Y1-y1)*((x2-x1) - (X2-X1)) for _ in range(T): x1,y1,x2,y2,X1,Y1,X2,Y2 = map(int,input().split()) print("Yes" if solve(x1,y1,x2,y2,X1,Y1,X2,Y2) else "No")