#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;

int main(){
  int n;
  cin>>n;
  while(n--){
    double x[4];
    double y[4];
    for(int i=0;i<4;i++){
      cin>>x[i]>>y[i];
    }
    x[3]=x[3]-x[2]+x[0];
    y[3]=y[3]-y[2]+y[0];
    double xx=x[3]-x[1];
    double yy=y[3]-y[1];
    if(-1e-10 <= xx && xx <= 1e-10 && -1e-10 <= yy && yy <= 1e-10){
      cout<<"YES"<<endl;
    }
    else{
      cout<<"NO"<<endl;
    }

  }
  return 0;
}