#include<iostream>
#include<algorithm>
using namespace std;

int main(){

  double ax,ay,bx,by,cx,cy,dx,dy;
  int n;

  cin >> n;

  for(int i=0;i<n;i++){
    cin >> ax >> ay >> bx >> by >> cx >> cy >> dx >> dy;

    if(ax == bx && cx == dx) cout << "YES" << endl;

    if((ay - cy) == (by - dy)){
      if(ax < cx && bx < dx) cout << "YES" << endl;
      if(ax > cx && bx > dx) cout << "YES" << endl;
      else cout << "NO" << endl;
    }

    else  cout << "NO" << endl;

  }
}