#include <iostream>
using namespace std;
int n;
double xa,xb,xc,xd,ya,yb,yc,yd,ta,tb,tc,td;
int main(){
	int i;
	cin >> n;
		for(i=0;i<n;i++){
			cin >> xa >> ya >> xb >> yb >> xc >> yc >> xd >> yd;
			ta = xb - xa;
			tb = yb - ya;
			tc = xd - xc;
			td = yd - yc;
			if(tb == td && ta == tc) cout << "YES" << endl;
			else cout << "NO" << endl;
		}
	return 0;
}