#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>	// require sort next_permutation count __gcd reverse etc.
#include <cstdlib>	// require abs exit atof atoi 
#include <cstdio>		// require scanf printf
#include <functional>
#include <numeric>	// require accumulate
#include <cmath>		// require fabs
#include <climits>
#include <limits>
#include <cfloat>
#include <iomanip>	// require setw
#include <sstream>	// require stringstream 
#include <cstring>	// require memset
#include <cctype>		// require tolower, toupper
#include <fstream>	// require freopen
#include <ctime>		// require srand
#define rep(i,n) for(int i=0;i<(n);i++)
#define ALL(A) A.begin(), A.end()
#define EPS 1e-8

using namespace std;

typedef long long ll;
typedef pair<int, int> P;

/*
	この解答は、どうやら誤差死。
	長さを求める平方根と
	掛け算とで誤差が出る模様。
	
	double の計算のときには
	如何に計算しないかがカギ。
*/

double dot (double xa, double ya, double xb, double yb )
{
	return (xa*xb + ya*yb );
}

double calc_len (double x, double y )
{
	return (x*x + y*y );
}

int main()
{
//	cut here before submit 
//	freopen ("testcase.Parallelism", "r", stdin );
	int n;
	scanf ("%d", &n );
	rep (i, n ){
		double x1, y1, x2, y2, x3, y3, x4, y4;
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		double d = dot (x2-x1, y2-y1, x4-x3, y4-y3 );
		double len1 = calc_len (x2-x1, y2-y1 );
		double len2 = calc_len (x4-x3, y4-y3 );

		if (fabs (len1*len2 - fabs(d*d ) ) < EPS ){
			cout << "YES" << endl;
		}else{
			cout << "NO" << endl;
		} // end if
	} // end loop
		
	return 0;
}