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

int digit(int i){
  int c=0;
  do{
    c++;
    i*=0.1;
  }while(i!=0);
  return c;
}

int main(){
  int n;
  cin>>n;
  while(n--){
    int xy[8];
    for(int i=0;i<8;i++){
      int j,s;
      scanf("%d.%d",&j,&s);
      xy[i]=j*pow(10,digit(s))+s;
    }

    //   cout<<xy[0]<<" "<<xy[1]<<" "<<xy[2]<<" "<<xy[3]<<" "<<xy[4]<<" "<<xy[5]<<" "<<xy[6]<<" "<<xy[7]<<endl;
    xy[6] = xy[6] - xy[4] + xy[0];
    xy[7] = xy[7] - xy[5] + xy[1];

    //   cout<<xy[0]<<" "<<xy[1]<<" "<<xy[2]<<" "<<xy[3]<<" "<<xy[4]<<" "<<xy[5]<<" "<<xy[6]<<" "<<xy[7]<<endl;
    //    cout<<xy[2]<<" "<<xy[6]<<" "<<xy[3]<<" "<<xy[7]<<endl;
    if(xy[2] == xy[6] && xy[3] == xy[7]){
      cout<<"YES"<<endl;
    }
    else{
      cout<<"NO"<<endl;
    }


  }
  return 0;
}