Go: package main

import "fmt"

func abs(x float64) float64 {
	if x < 0 {
		return -x
	}
	return x
}

func main() {
	var n int
	var x1, y1, x2, y2, x3, y3, x4, y4 float64
	fmt.Scan(&n)
	for i := 0 ; i < n; i++ {
		fmt.Scanf("%f %f %f %f %f %f %f %f", &x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4)
		if abs((x2-x1)*(y4-y3) - (y2-y1)*(x4-x3)) < 1e-10 {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

C++: #include<iostream>
#include<cmath>
using namespace std;

int main() {
	double x1, y1, x2, y2, x3, y3, x4, y4;
	int n;
	cin >> n;
	for (int i = 0 ; i < n; i++) {
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		double t_AB, t_CD;
		t_AB = (y2 - y1) / (x2 - x1);
		t_CD = (y4 - y3) / (x4 - x3);
		if (abs((y2 - y1)*(x4 - x3) - (y4 - y3)*(x2 - x1))<1e-10) {
			cout << "YES" << endl;
		}
		else {
			cout << "NO" << endl;
		}
	}
	return 0;

}

C++: #include<iostream>
#include<cstring>
using namespace std;
int main(){
  int n;
  double x1,y1,x2,y2,x3,y3,x4,y4,lI,lII;
  cin >> n;
  while(n--){
    cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
    cout << (abs((y2-y1)/(x2-x1) - (y4-y3)/(x4-x3)) < 1e-10 ? "YES" : "NO") << endl;
  }
}

C++: #include<cstdio>
#include<iostream>
#include<algorithm>
#include<vector>
#include<set>
#include<map>
#include<string>
#include<functional>
#include<queue>
#include<stack>
#include<math.h>
#define INF 999999
#define EPS 1.0e-10

using namespace std;

typedef long long ll;

int n;
double x[5];
double y[5];

int main()
{
	cin >> n;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < 4; j++) {
			cin >> x[j] >> y[j];
		}

		double k = (x[1] - x[0])*(y[3] - y[2])-(x[3] - x[2])*(y[1] - y[0]);
		if (fabs(k)< EPS)cout << "YES" << endl;
		else cout << "NO" << endl;
	}

	
	return 0;
}

C++: #include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <sstream>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <numeric>
#include <cmath>
#include <climits>
#include <limits>
#include <cfloat>
#include <fstream>
using namespace std;

int main()
{
//	cut here before submit 
//	freopen("testcase.pl", "r", stdin);
	string str = "";
	int n;

	getline (cin, str );
	stringstream ssn(str);
	ssn >> n;

	int i,j;
	for (i = 0; i < n; ++i){
		vector <double> px (4, 0.0);
		vector <double> py (4, 0.0);
		getline (cin, str );
		stringstream ss(str);
		for (j = 0; j < 4; ++j){
			ss >> px[j] >> py[j];
		} // end for
		multimap <double, double> v;

		for (j = 0; j < 2; ++j){
			v.insert (make_pair (px[2*j + 1] - px[2*j], py[2*j + 1] - py[2*j] ) );
		} // end for

		multimap <double, double>::iterator it = v.begin();
		double xp = (*it).first;
		double yp = (*it).second;
		++it;		
		double xa = (*it).first;
		double ya = (*it).second;
		bool found = false;

		if (xp != 0. && yp != 0.){
			if ( fabs( (*it).first/xp - (*it).second/yp ) < 1e-6 ){
				found = true;
			}else{
				found = false;
			} // end if
		}else{	// if (xp == 0. || yp == 0. )
			if (xp == 0. && yp != 0. ){ // xp == 0. && yp != 0.
				if (xa == 0.){
					found = true;
				}else{
					found = false;
				} // end if
			}else if (xp != 0. && yp == 0.){ // xp != 0. && yp == 0.
				if (ya == 0.){
					found = true;
				}else{
					found = false;
				} // end if
			}else{ // if (xp == 0. && yp == 0.)
				if (xa == 0. &&  ya == 0.){
					found = true;
				}else{
					found = false;
				} // end if
			} // end if
		} // end if

		if (found ){
			cout << "YES" << endl;
		}else{
			cout << "NO" << endl;
		} // end if

	} // end for
		
	return 0;
}

C++: #include<iostream>
using namespace std;

int main(){
	int n;
	double a1,a2,b1,b2;
	double c1,c2,d1,d2;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a1>>a2>>b1>>b2>>c1>>c2>>d1>>d2;
		if( (b2-a2)/(b1-a1) == (d2-c2)/(d1-c1) )
			cout<<"YES"<<endl;
		else 
			cout<<"NO"<<endl;
	}

}

C++: #include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<vector>
#include<cmath>
#include<cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define it ::iterator
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double ESP=1e-10;
using namespace std;
int main(){
  int n;
  cin>>n;
  while(n--){
    double x[4];
    double y[4];
    rep(i,4)cin>>x[i]>>y[i];
    if(abs((y[1]-y[0])*(x[3]-x[2])-(y[3]-y[2])*(x[1]-x[0]))<ESP)cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
  }
}

C++: #include<iostream>
#include<cstdio>
using namespace std;
int main()
{
	int n;
	double x[4],y[4];

	cin >> n;

	for(int i = 0;i < n;i++){
		for(int j = 0;j < 4;j++){
			scanf("%lf",&x[j]);
		}

		for(int j = 0;j < 4;j++){
			scanf("%lf",&y[j]);
		}

		int a1 = (y[2]-y[1])/(x[2]-x[1]);
		int a2 = (y[4]-y[3])/(x[4]-x[3]);

		if(a1 == a2){
			cout << "YES" << endl;
		}
		else cout << "NO" << endl;
	}
}

C++: //#define _GRIBCXX_DEBUG
#include <algorithm>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iostream>
#include <iomanip>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;


// ?????¬???????????¬??????
#pragma region MACRO
#define P(x) cout << (x) << endl
#define p(x) cout << (x)
#define PED cout << "\n"
#define rep(i,n) for(int i=0; i<(int)n; ++i)
#define REP(i,x,n) for(int i=x; i<(int)n; ++i)
#define repi(i,n) for(int i=0; i<=(int)n; ++i)
#define REPI(i,x,n) for(int i=x; i<=(int)n; ++i)
#define ILP while(true)
#define FOR(i,c) for(__typeof((c).begin())!=(c).begin(); i!=(c).end(); ++i)
#define ALL(c) (c).begin(), (c).end()
#define mp make_pair
#pragma endregion

// ???
#pragma region TYPE_DEF
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<string, string> pss;
typedef pair<string, int> psi;
typedef pair<int, string> pis;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<long> vl;
typedef vector<long long> vll;
typedef vector<string> vs;
#pragma endregion

// Effective std
#pragma region ESTD
template<typename C, typename T>
constexpr int count(C& c, T t) { return count(ALL(c), t); }
template<typename C, typename F>
constexpr int count_if(C& c, F f) { return count_if(ALL(c), f); }
template<typename C, typename T>
void erase(C& c, T t) { remove(ALL(c), t), c.end(); }
template<typename C>
void remove(vector<C>& c, unsigned int index) { c.erase(c.begin()+index); }
template<typename C, typename T, typename U>
constexpr void replace(C& c, T t, U u) { replace(ALL(c), t, u); }
template<typename C, typename F, typename U>
constexpr void replace_if(C& c, F f, U u) { (ALL(c), f, u); }
template<typename C>
constexpr void reverse(C& c) { reverse(ALL(c)); }
template<typename C>
constexpr void sort(C& c) { sort(ALL(c)); }
template<typename C, typename Pred>
constexpr void sort(C& c, Pred p) { sort(ALL(c), p); }
#pragma endregion

// ?????°
#pragma region CONST_VAL
#define PI (2*acos(0.0))
#define EPS (1e-9)
#define MOD (int)(1e9+7)
#pragma endregion

bool func(vector<long double> x, vector<long double> y) {
    if ((y[1] - y[0]) * (x[3] - x[2]) == (y[3] - y[2]) * (x[1] - x[0])) return true;
    return false;
}

int main()
{
    int n;
    cin >> n;
    vector<long double> x(4);
    vector<long double> y(4);

    while(n--) {
        rep(i,4) cin >> x[i] >> y[i];
        P(func(x,y) ? "YES" : "NO");
    }
    return 0;
}