import sys, time, random from collections import deque, Counter, defaultdict input = lambda: sys.stdin.readline().rstrip() ii = lambda: int(input()) mi = lambda: map(int, input().split()) li = lambda: list(mi()) inf = 2 ** 61 - 1 mod = 998244353 from fractions import Fraction def line_cross_point(P0, P1, Q0, Q1): x0, y0 = P0; x1, y1 = P1 x2, y2 = Q0; x3, y3 = Q1 a0 = x1 - x0; b0 = y1 - y0 a2 = x3 - x2; b2 = y3 - y2 d = a0*b2 - a2*b0 if d == 0: # two lines are parallel return None # s = sn/d sn = b2 * (x2-x0) - a2 * (y2-y0) # t = tn/d #tn = b0 * (x2-x0) - a0 * (y2-y0) return x0 + Fraction(a0*sn,d), y0 + Fraction(b0*sn,d) def solve(): x1, y1, x2, y2, X1, Y1, X2, Y2 = mi() if (x1 == X1) and (y1 == Y1) and (x2 == X2) and (y2 == Y2): print('Yes') return elif (x1 - x2) * (Y1 - Y2) != (X1 - X2) * (y1 - y2): print('No') return elif (x2 - x1) ** 2 + (y2 - y1) ** 2 <= (X1 - X2) ** 2 + (Y2 - Y1) ** 2: print('No') return else: if (X1 - X2) * (x1 - x2) + (Y1 - Y2) * (y1 - y2) < 0: print('No') else: print('Yes') for _ in range(ii()): solve()