#include<stdio.h>
#include<math.h>

int main(){
	double x1,x2,x3,x4,y1,y2,y3,y4;
	double yoko1,yoko2,tate1,tate2;
	int ans[100]={0};
	int n,i;
	
	scanf("%d",&n);
	
	for(i=0;i<n;i++){
	scanf("%lf %lf %lf %lf %lf %lf %lf %lf",&x1,&x2,&x3,&x4,&y1,&y2,&y3,&y4);
	yoko1=(x1-x3)*(x1-x3);
	yoko2=(x2-x4)*(x2-x4);
	tate1=(y1-y3)*(y1-y3);
	tate2=(y2-y4)*(y2-y4);
	
	if(sqrt(yoko1+tate1)==sqrt(yoko2+tate2))ans[i]=1;
	else ans[i]=0;
	}
	
	for(i=0;i<n;i++){
		if(ans[i]==1)printf("YES\n");
		else printf("NO\n");
	}
return 0;
}