#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;

double dis(double a, double b){
	double d;
	if((0<=a && 0<=b) || (a<=0 && b<= 0)){
		d = a-b;
	}else{
		d = abs(a) + abs(b);
	}
	return d;
}
int main(){
	double x1, x2, x3, x4, y1, y2, y3, y4;
	double ab_x, ab_y, cd_x, cd_y;
	int n, i;
	cin >> n;
	for(i=0;i<n;i++){
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3>> x4 >> y4;
		
		ab_x = dis(x1,x2);
		ab_y = dis(y1,y2);
		cd_x = dis(x3,x4);
		cd_y = dis(y3,y4);
		if(ab_y/ab_x == cd_y/cd_x){
			cout << "YES\n";
		}else{
			cout << "NO\n";
		}
	
	}
	return 0;
}