#include <iostream>
using namespace std;

int main() {
  int n = 0;
  cin >> n;

  for(int i = 0; i < n; i++) {
    double d[8];
    for(int j = 0; j < 4*2; j++)
      cin >> d[j];
    if(d[4] + d[0]-d[2] == d[6] && d[5] + d[1]-d[3] == d[7])
      cout << "YES" << endl;
    else if(d[4] - (d[0]-d[2]) == d[6] && d[5] - (d[1]-d[3]) == d[7])
      cout << "YES" << endl;
    else if(d[6] + (d[0]-d[2]) == d[4] && d[7] + (d[1]-d[3]) == d[5])
      cout << "YES" << endl;
    else if(d[6] - (d[0]-d[2]) == d[4] && d[7] - (d[1]-d[3]) == d[5])
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }

  return 0;
}