#include <stdio.h>

/* 2ツ点ツづーツ津環づゥツ陳シツ静シツづ個傾ツつォツづーツ仰づ淞づゥ */
void calc_slope(double x1, double y1, double x2, double y2, double* a, double* b)
{
  *a = (y2 - y1) / (x2 - x1);
  *b = y1 - ((*a) * x1);
  return;
}

int main(void)
{
  int n, i;
  double x[4], y[4], a[2], b[2];
  scanf("%d", &n);
  for(i = 0; i < n; i++)
    {
      int i;
      for(i = 0; i < 4; i++)
	{
	  scanf("%lf", x + i);
	  scanf("%lf", y + i);
	}
      for(i = 0; i < (4 / 2); i++)
	{
	  calc_slope( x[i*2], y[i*2], x[i*2+1], y[i*2+1], &a[i], &b[i]);
	}
      if((a[0] == a[1]) &&  (b[0] != b[1]))
	{
	  printf("YES\n");
	}
      else
	{
	  printf("NO\n");
	}
    }
  return 0;
}