N = int(input()) for _ in range(N) : A = list(map(int, input().split())) D = [A[2] - A[0], A[3] - A[1], A[6] - A[4], A[7] - A[5]] all_same = True for i in range(4) : all_same = all_same and A[i] == A[i + 4] if all_same : print("Yes") elif D[0] ** 2 + D[1] ** 2 <= D[2] ** 2 + D[3] ** 2 : print("No") else : det = D[3] * D[0] - D[2] * D[1] dot = D[0] * D[2] + D[1] * D[3] if det == 0 and dot > 0 : print("Yes") else : print("No")