def same_sign(x, y): return (x >= 0) == (y >= 0) T = int(input()) for i in range(T): x1, y1, x2, y2, X1, Y1, X2, Y2 = map(int, input().split()) P1 = complex(x1, y1) P2 = complex(x2, y2) Q1 = complex(X1, Y1) Q2 = complex(X2, Y2) A = P1-P2 B = Q1-Q2 if abs(A) > abs(B) and B != 0 and (A/B).imag == 0: if same_sign(A.real, B.real) and same_sign(A.imag, B.imag): print("Yes") else: print("No")