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

int main(void)
{
	int i,count=0;
	cin>>i;
	while(count != i)
	{
	float x1,y1,x2,y2,x3,y3,x4,y4;
	cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;

	float ax,ay,bx,by;
	
	if(x2<x1){ax=x1-x2;bx=x3-x4;}
	else{ax=x2-x1;bx=x4-x3;}
	
	if(y2<y1){ay=y1-y2;by=y3-x4;}
	else{ay=y2-y1;by=y4-y3;}

	if(ax==bx&&ay==by)puts("YES");
	else puts("NO");
	count++;
	}
	
	return 0;
}