#include <iostream>
#include <complex>
using namespace std;
#define REP(i, n)       REPEAT(i, 0, n)
#define REPEAT(i, k, n) for (int i = (k); i < (n); ++i)

#define X real()
#define Y imag()
typedef double D;
typedef complex<double>P;
#define EPS (1e-9)
 
bool iscross(P &p1, P &p2, P &p3, P &p4){
    P d1 = p2 - p1, d2 = p4 - p3;
    D det = d2.X * d1.Y - d1.X * d2.Y;
    if(abs(det) < EPS) return false;
    return true;
}
 
int main(){
    int n;
    cin >> n;
    REP(i,n){
        double x1, y1, x2, y2, x3, y3, x4, y4;
        cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
        P p1(x1,y1), p2(x2,y2), p3(x3,y3), p4(x4,y4);
        if(!iscross(p1,p2,p3,p4)){
            cout << "YES" << endl;
        } else {
            cout << "NO" << endl;
        }
    }
    return 0;
}