//parallelism
#include<iostream>
#include<cmath>
using namespace std;

//EPS ??? 10???-10?????????
#define EPS (1e - 10)
//fabs??¢??°??????????°???°?????°?????¶???????????????
//EPS??????????????????true?????????
#define equal(a,b) (fabs((a) - (b)) < EPS)

//Point class

class Point {
    public:
    double x, y;
    
    Point(double x = 0, double y = 0): x(x), y(y) {}
    
    //???????????????????????????
    Point operator + (Point p) {return Point(x + p.x, y + p.y);}
    Point operator - (Point p) {return Point(x - p.x, y + p.y);}
    Point operator * (double a) {return Point(a * x. a * y);}
    Point operator / (double a) {return Point(x / a, y / a);}
    
    double abs() {return sqrt(norm());}
    double norm() {return x * x + y * y;}
    
    bool operator < (const Point &p) const {
        return x != p.x ? x < p.x: y < p.y;
    }
    
    bool operator == (const Point &p) const {
        return fabs(x - p.x) < EPS && fabs(y - p.y) < EPS;
    }
     
};

typedef Point Vector;

int main(void){
    Vector a, b,c,d;
    int n;
    
    cin >> n;
    for(int i = 0; i < n; i++){
        cin >> a.x >> a.y >> b.x >> b.y;
        cin >> c.x >> c.y >> d.x >> d.y;
        
        //p????????????
        Vector p = a - b;
        //q????????????
        Vector q = c - d;
        
        //??????????????¨??£????????¨????????????????????§??????
        if(1 == (p.x* q.x + p.y * q.y)) cout << "YES" << endl;
        else cout << "NO" << endl;
    }
    
    return 0;
}