#include <bits/stdc++.h>

using namespace std;

int main() {
  int n;
  scanf("%d", &n);

  for (int c = 0; c < n; ++c) {
    double input[8];
    for (int i = 0; i < 8; ++i) {
      scanf("%lf", &input[i]);
    }
    pair<double, double> vec_a(input[2] - input[0], input[3] - input[1]);
    pair<double, double> vec_b(input[6] - input[4], input[7] - input[5]);
    double d_a = sqrt(pow(vec_a.first, 2.0) + pow(vec_a.second, 2.0));
    double d_b = sqrt(pow(vec_b.first, 2.0) + pow(vec_b.second, 2.0));
    double ip = vec_a.first * vec_b.first + vec_a.second * vec_b.second;
    
    if (abs(abs(ip) - d_a * d_b) < 0.0000001) {
      cout << "YES" << endl;
    } else {
      cout << "NO" << endl;
    }
  }
}