def solve() -> bool: x1, y1, x2, y2, X1, Y1, X2, Y2 = map(int, input().split()) if (x1, y1) == (X1, Y1) and (x2, y2) == (X2, Y2): return True vx = x2 - x1 vy = y2 - y1 ux = X2 - X1 uy = Y2 - Y1 if vx * uy - vy * ux != 0: return False if vx * ux + vy * uy < 0: return False if vx * vx + vy * vy <= ux * ux + uy * uy: return False return True for _ in range(int(input())): print("Yes" if solve() else "No")