#include <algorithm>
#include <cmath>
#include <cstdio>

using namespace std;

int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    double x1, y1, x2, y2, x3, y3, x4, y4;
    scanf(
        "%lf %lf %lf %lf %lf %lf %lf %lf",
        &x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4);

    double v1x = x1 - x2, v1y = y1 - y2;
    double v2x = x3 - x4, v2y = y3 - y4;
    double prod = v1x * v2x + v1y * v2y;
    if (prod < 0.0) { prod *= -1; }

    double z1 = sqrt(v1x * v1x + v1y * v1y);
    double z2 = sqrt(v2x * v2x + v2y * v2y);

    puts(abs(prod - z1 * z2) < 0.0000001 ? "YES" : "NO");
  }

  return 0;
}