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

struct Point{
  double x,y;
};
bool isParallel(const vector<Point>& data){
  return (data[1].y-data[0].y)*(data[3].x-data[2].x)==(data[3].y-data[2].y)*(data[1].x-data[0].x);
}

int main(){
  int n;
  cin>>n;
  vector<vector<Point> > data(n);
  for(int j=0;j<n;j++){
    data[j].resize(4);
    for(int i=0;i<4;i++){
      cin>>data[j][i].x>>data[j][i].y;
    }
  }
  for(int i=0;i<n;i++){
    for(int j=0;j<4;j++){
      cout<<data[i][j].x<<" "<<data[i][j].y<<" ";
    }
    cout<<endl;
  }
  for(int i=0;i<n;i++){
    if(isParallel(data[i])){
      cout<<"YES"<<endl;
    }else{
      cout<<"NO"<<endl;
    }
  }
}