#include <iostream>
#include <iomanip>
#include <list>
#include <map>
#include <algorithm>
#include <stack>
#include <string>
#include <vector>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>

using namespace std;


int main(){
	vector<pair<double,double> > factor(4);
	pair<double,double> tmp;
	int n;
	cin >> n;
	while(n--){
		for(int i = 0; i < 4; i++){
			cin >> factor[i].first >> factor[i].second;
		}
		for(int i = 0; i < 4; i++){
			if(i % 2 == 1){
				factor[i].first += tmp.first;
				factor[i].second += tmp.second;
			}
			else{
				tmp.first = 0 - factor[i].first;
				tmp.second = 0 - factor[i].second;
				factor[i].first += (0 - factor[i].first);
				factor[i].second += (0 - factor[i].second);
			}
		}

		if(factor[0].first == factor[2].first && factor[0].second == factor[2].second){
			if(factor[1].first == factor[3].first && factor[1].second == factor[3].second){
				cout << "YES" << endl;
			}
			else{
				cout << "NO" << endl;
			}
		}
		else{
			cout << "NO" << endl;
		}
	}
	
	return 0;
}