#include<iostream>
#include<math.h>
#include<stdio.h>
using namespace std;
int n,AB,CD;
double ax,ay,bx,by,cx,cy,dx,dy,ab,cd,abx,aby,cdx,cdy,abC,cdC;
int main(){
	cin>>n;
	for(int i=0;i<n;i++){
		AB=CD=0;
		cin>>ax>>ay>>bx>>by>>cx>>cy>>dx>>dy;
		abx=(ax-bx);
		cdy=(cy-dy);
		aby=(ay-by);
		cdx=(cx-dx);
		if(abx==0.0&&aby==0.0)AB=1;
		if(cdx==0.0&&cdy==0.0)CD=1;
		if(AB==1||CD==1){
			cout<<"NO"<<endl;
			continue;
		}
		if(abx!=0&&cdx!=0){
			ab=aby/abx;
			cd=cdy/cdx;
			abC=ay-ab*ax;
			cdC=cy-cd*cx;
			if(ab==cd&&abC!=cdC){
				cout<<"YES"<<endl;
			}else{
				cout<<"NO"<<endl;
			}
		}else{
			if(abx==cdx&&ax!=cx){
				cout<<"YES"<<endl;
			}else{
				cout<<"NO"<<endl;
			}
		}
	}
	return 0;
}