#include<iostream>
#include<queue>
#include<string>
#include<stack>
#include<cstdio>
#include<algorithm>

using namespace std;

int main(void)
{
  double x,y,x2,y2;
  double x1,y1,x3,y3;
  int n;
  int i;
  long double a=0,b=0;
  int k=0;
  int j=0;

  cin>>n;

  for(i=0;i<n;i++)
    {
      cin>>x>>y>>x1>>y1;
      cin>>x2>>y2>>x3>>y3;

      if(x>x1)swap(x,x1);
      if(x2>x3)swap(x2,x3);
      if(y>y1)swap(y,y1);
      if(y2>y3)swap(y2,y3);

      a=(y1-y)*(x3-x2);
      j++;

      b=(y3-y2)*(x1-x);
      j++;


      if(a==b || ((x1-x)==0 && (x3-x2)==0) || ((y1-y)==0 && (y3-y2)==0))
        puts("YES");
      else
        puts("NO");
    }

}