import std.stdio, std.conv, std.array, std.algorithm, std.string, std.math;

void main() {
    uint count = to!uint(readln().chomp);
    for (uint i = 0; i < count; ++i) {
        double[] t = map!(to!double)(readln().chomp.split).array;
        double[] a = [t[0]-t[2], t[1]-t[3]];
        double[] b = [t[4]-t[6], t[5]-t[7]];
        if (is_zero(inner_product(a, rotate2(b, to_rad(90.0))))) {
            writeln("YES");
        } else {
            writeln("NO");   
        }
    }
}

double to_rad(double degree) {
    return degree/180.0*3.14159265358979323846;   
}

bool is_zero(double x) {
    if (-0.0000009 <= x && x <= 0.0000009) {
        return true;
    } else {
        return false;
    }
}

double[] rotate2(double[] v, double angle) {
    return [v[0]*cos(angle) - v[1]*sin(angle), v[0]*sin(angle) + v[1]*cos(angle)];
}

double inner_product(double[] a, double[] b) {
    double result = 0.0;
    for (int i = 0; i < a.length; ++i) {
        result += a[i] * b[i];
    }
    return result;
}