#!/usr/bin/env python
n = input()

for loop in range(n):
	S = raw_input().split()
	x1, y1, x2, y2, x3, y3, x4, y4 = map(float, S)

	v1 = [x2 - x1, y2 - y1]
	v2 = [x4 - x3, y4 - y3]

	norm = (v1[0] * v1[0] + v1[1] * v1[1]) * (v2[0] * v2[0] + v2[1] * v2[1])
	inn = v1[0] * v2[0] + v1[1] * v2[1]

	if abs(norm) - inn * inn < 1e-10:
		print "YES"
	else:
		print "NO"
