#define _USE_MATH_DEFINES
#include<iostream>
#include<complex>
using namespace std;
#define EPS 1e-10

int main(void){
	int n;
	cin >> n;
	for(int i=0; i<n; i++){
		complex<double> p1, p2, p3, p4;
		double x1, y1, x2, y2, x3, y3, x4, y4;
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		p1 = complex<double>(x1, y1);
		p2 = complex<double>(x2, y2);
		p3 = complex<double>(x3, y3);
		p4 = complex<double>(x4, y4);
		
		if( (arg(p1-p2) - arg(p3-p4))>-EPS && (arg(p1-p2) - arg(p3-p4))<EPS )
			cout << "YES" << endl;
		else if( (arg(p1-p2) + M_PI - arg(p3-p4))>-EPS && (arg(p1-p2) + M_PI - arg(p3-p4))<EPS )
			cout << "YES" << endl;
		else if( (arg(p1-p2) - M_PI - arg(p3-p4))>-EPS && (arg(p1-p2) - M_PI - arg(p3-p4))<EPS )
			cout << "YES" << endl;
		else
			cout << "NO" << endl;
	}
	return 0;
}