#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cctype>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <string>
#include <iostream>
#include <sstream>
#include <functional>
#include <utility>

using namespace std;

#define rep(i,n) for(int i=0;i<(int)(n);i++)

short n, i, j;
double a[4], b[4];
int d[4], e[4];

int main(){
	scanf("%d", &n);
	rep(i, n){
		rep(j, 4){
			scanf("%lf %lf", &a[j], &b[j]);
			d[j] = a[j] * 10000;
			e[j] = b[j] * 10000;
		}
		if(d[1] - d[0] == d[3] - d[2] && e[1] - e[0] == e[3] - e[2]) printf("YES\n");
		else printf("NO\n");
	}
	return 0;
}