EPS = 1e-9
INF = 1e9

def check(a,b)
  (a - b).abs <= EPS || (a - b).abs <= [a.abs, b.abs].max * EPS
end

gets.to_i.times do
  arr = gets.chomp.split(" ").map(&:to_f)
  a = [].push(arr.shift).push(arr.shift)
  b = [].push(arr.shift).push(arr.shift)
  c = [].push(arr.shift).push(arr.shift)
  d = [].push(arr.shift).push(arr.shift)

  a,b=b,a if a[0]>b[0]
  c,d=d,c if c[0]>d[0]

  # a<b, c<d

  ab = INF
  cd = INF

  ab = (b[1]-a[1])/(b[0]-a[0]) if !check(a[0],b[0])
  cd = (d[1]-c[1])/(d[0]-c[0]) if !check(c[0],d[0])

  puts check(ab, cd) ? "YES" : "NO"
end