#include <iostream>

enum {X1,Y1,X2,Y2,X3,Y3,X4,Y4};

void calcDistance(int x1, int y1, int x2, int y2, int* dx, int* dy) {
	if(x1 < x2) {
		*dx = x2 - x1;
		*dy = y2 - y1;
	} else {
		*dx = x1 - x2;
		*dy = y1 - y2;
	}
}

int main() {
	int n; std::cin >> n;
	double dp[8];
	int ip[8],dx1,dy1,dx2,dy2;
	for(int i=0; i<n; i++) {
		for(int j=0; j<8; j++) std::cin >> dp[j];
		for(int j=0; j<8; j++) ip[j] = (int)(dp[j] * 1000000);
		if(ip[X1] == ip[X2] || ip[X3] == ip[X4]) {
			if(ip[X1] == ip[X2] && ip[X3] == ip[X4]) {
				std::cout << "YES" << std::endl;
			} else {
				std::cout << "NO" << std::endl;
			}
		} else {
			calcDistance(ip[X1],ip[Y1],ip[X2],ip[Y2],&dx1,&dy1);
			calcDistance(ip[X3],ip[Y3],ip[X4],ip[Y4],&dx2,&dy2);
			if(((long long)dy1 * dx2) == ((long long)dx1 * dy2)) {
				std::cout << "YES" << std::endl;
			} else {
				std::cout << "NO" << std::endl;
			}
		}
	}
	return 0;
}
