#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld =long double;
const ld eps = 1e-9;

enum R_Way {
	R_Left,
	R_Front,
	R_Right,
	R_Back,

	R_Dummy,
};

struct Dice {
	int tp;
	int bo;
	int no;
	int so;
	int ea;
	int we;
	Dice(int tp_, int bo_, int no_, int so_, int ea_, int we_) :
		tp(tp_), bo(bo_), no(no_), so(so_), ea(ea_), we(we_) {

	}
	Dice(vector<int>pips_) {

	}

	Dice() {
		tp = 1;
		/*bo = 6;
		no = 2;
		so = 5;
		ea = 3;
		we = 4;*/
	}

	int rotate(const R_Way way) {
		switch (way) {
		case R_Right: {
			int c = tp;
			tp = we;
			we = bo;
			bo = ea;
			ea = c;
		}
					  break;
		case R_Back: {
			int c = tp;
			tp = so;
			so = bo;
			bo = no;
			no = c;
		}
					 break;
		case R_Left: {
			int c = tp;
			tp = ea;
			ea = bo;
			bo = we;
			we = c;
		}
					 break;
		case R_Front: {
			int c = tp;
			tp = no;
			no = bo;
			bo = so;
			so = c;
		}
					  break;
		default:
			assert(false);
		}
		return tp;
	}
	int rotate(const int way) {
		return rotate(static_cast<R_Way>(way));
	}
	void spin(const int  clockwise) {
		if (!clockwise) {

			rotate(R_Way::R_Left);
			rotate(R_Way::R_Back);
			rotate(R_Way::R_Right);
		}
		else {

			rotate(R_Way::R_Left);
			rotate(R_Way::R_Front);
			rotate(R_Way::R_Right);
		}
	}
	int hash()const {
		return tp + we * 6 + no * 36;
	}
};
int geteast(int top, int south) {
	map<pair<int, int>, int>mp;
	mp[make_pair(1, 2)] = 3;
	mp[make_pair(1, 3)] = 5;
	mp[make_pair(2, 3)] = 1;
	mp[make_pair(2, 4)] = 6;
	bool rev = false;
	if (top >= 4) {
		rev = !rev; top = 7 - top;
	}
	if (south >= 4) {
		rev = !rev; south = 7 - south;
	}
	if (top > south) {
		rev = !rev; swap(top, south);
	}
	return mp[make_pair(top, south)];
}

bool connect(char a, char b) {
	return abs(a-b)==abs('A'-'a');
}

bool solve(bitset<8>&used, const int now, vector<Dice>&dices) {
	if(now==8)return true;
	else {
		for (int i = 0; i < 8; ++i) {
			if(used[i])continue;
			else {
				for (int tp = 1; tp <= 6; ++tp) {
					for (int so = 1; so <= 6; ++so) {
						if(tp==so||tp+so==7)continue;
						int le=geteast(tp,so);

						vector<int>perms(6);
						perms[0]=tp-1;
						//perms[1]=
					}
				}
			}
		}
	}
}

int main()
{
	int N;cin>>N;
	for (int i = 0; i < N; ++i) {
		vector<ld>v(8);
		for(int j=0;j<8;++j)cin>>v[j];

		ld ax=v[2]-v[0];
		ld ay=v[3]-v[1];

		ld bx=v[6]-v[4];
		ld by=v[7]-v[5];

		bool ok=abs(ax*by-bx*ay)<eps/1000;

		if(ok)cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
	}
	return 0;
}
