for _ in range(int(input())): x1, y1, x2, y2, X1, Y1, X2, Y2 = map(int, input().split()) dx, dy = x1 - x2, y1 - y2 dX, dY = X1 - X2, Y1 - Y2 ans = dx * dY - dy * dX == 0 and dx * dX + dy * dY > 0 and dx ** 2 + dy ** 2 > dX ** 2 + dY ** 2 or (x1, y1) == (X1, Y1) and (x1, y2) == (X2, Y2) print('Yes' if ans else 'No')