Go: package main

import (
	"bufio"
	"os"
	"strconv"
	"fmt"
	"strings"
)

var scanner = bufio.NewScanner(os.Stdin)

func nextInt() int {
	scanner.Scan()
	i, e := strconv.Atoi(scanner.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func main() {
	n := nextInt()
	for i := 0; i < n; i++ {
		scanner.Scan()
		points := strings.Split(scanner.Text(), " ")
		fpoints := make([]float64, 0)
		for _, v := range points {
			tmp, _ := strconv.ParseFloat(v, 64)
			fpoints = append(fpoints, tmp)
		}
		if fpoints[0] == fpoints[2] && fpoints[4] == fpoints[6] {
			fmt.Println("YES")
		} else {
			a := (fpoints[1] - fpoints[3]) / (fpoints[0] - fpoints[2])
			b := (fpoints[5] - fpoints[7]) / (fpoints[4] - fpoints[6])
			if a == b {
				fmt.Println("YES")
			} else {
				fmt.Println("NO")
			}
		}
	}
}

C++: #include <cstdio>
#include <complex>
#include <vector>
 
using namespace std;
 
typedef complex<double> P;
struct L : public vector<P> {
    L(const P &a, const P &b) {
        push_back(a);
        push_back(b);
    }
};
 
const double EPS = 1e-8;
 
double cross(P a, P b)
{
    return imag(conj(a) * b);
}
 
bool intersectLL(const L &l, const L &m)
{
    return fabs(cross(l[1]-l[0], m[1]-m[0])) > EPS;
}
 
int main()
{
    int n;
 
    scanf("%d", &n);
    for (int i = 0; i < n; ++i) {
        P p[4];
        double x, y;
 
        scanf("%lf %lf", &x, &y);
        p[0] = P(x, y);
        scanf("%lf %lf", &x, &y);
        p[1] = P(x, y);
        scanf("%lf %lf", &x, &y);
        p[2] = P(x, y);
        scanf("%lf %lf", &x, &y);
        p[3] = P(x, y);
 
        puts(intersectLL(L(p[0], p[1]), L(p[2], p[3])) ? "NO" : "YES");
    }
 
    return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
typedef complex<double> xy_t; 
xy_t a[100], b[100], c[100], d[100];
double x, y;
int n;
int main()
{
	cin >> n;
	for(int i=0; i<n; i++)
	{
		cin >> x >> y;
		a[i]=xy_t(x, y);
		cin >> x >> y;
		b[i]=xy_t(x, y);
		cin >> x >> y;
		c[i]=xy_t(x, y);
		cin >> x >> y;
		d[i]=xy_t(x, y);
	}
	for(int i=0; i<n; i++)
	{
		if((conj(b[i]-a[i])*(d[i]-c[i])).imag()==0)
		{
			cout << "YES" << endl;
		}
		else
		{
			cout << "NO" << endl;
		}
	}
	return 0;
}

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

int main(){

	typedef struct{
		double x, y;
	}_td;

	int n;
	_td p1, p2, p3, p4, v_ab, v_cd;
	double del, eps;
	eps = 0.000001;
	
	cin >> n;
	
	for(int i=0; i<n; i++){
		cin >> p1.x >> p1.y >> p2.x >> p2.y >> p3.x >> p3.y >> p4.x >> p4.y;
	
		v_ab.x = p1.x - p2.x;
		v_ab.y = p1.y - p2.y;
		v_cd.x = p3.x - p3.y;
		v_cd.y = p4.x - p4.y;
		
		del = v_ab.x * v_cd.y - v_ab.y * v_cd.x;
		if(del < eps) cout << "YES" << endl;
		else cout << "NO" << endl;
	}

	return 0;

}

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

int main(void)
{
    int n;
    cin >> n;
    for (int i = 0; i < n; ++i) {
        double x1, y1, x2, y2, x3, y3, x4, y4;
        cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
        if (((x2==x1)&&(y2==y1)) || (x4==x3)&&(y4==y3))
            cout << "NO" << endl;
        else if ((x2-x1)==0 || (x4-x3)==0)
            cout << (((x2-x1)==0&&(x4-x3)==0)? "YES" : "NO") << endl;
        else
            cout << (((int)((y2-y1)*(x4-x3)) == (int)((y4-y3)*(x2-x1)))? "YES" : "NO") << endl;
    }
    return 0;
}

C++: #define	_USE_MATH_DEFINES
#include <iostream>
#include <algorithm>
#include <functional>
#include <vector>
#include <cstdio>
#include <string>
#include <cmath>
#include <cfloat>
#include <map>
#include <queue>
#include <stack>
#include <list>
using namespace std;

int main(){

	int n;
	cin>>n;
	double x1,y1,x2,y2,x3,y3,x4,y4;
	
	while(n>0){
		double a,b;
	cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
		
		a=(y2-y1)/(x2-x1);
		b=(y4-y3)/(x4-x3);
		
		if(a==b)
			cout<<"YES"<<endl;
		else
			cout<<"NO"<<endl;
		
		n--;
	}
}

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

int main()
{
	int n;
	cin >> n;
	double a[100][4][2];
	for (int i = 0;i < n;i++)
		for (int j = 0;j < 4;j++)
			cin >> a[i][j][0] >> a[i][j][1];
	for (int k = 0;k < n;k++) {
		if (a[k][0][0] - a[k][1][0] == 0 && a[k][2][0] - a[k][3][0])
			cout << "YES" << endl;
		else {
			if ((a[k][2][0] - a[k][3][0])*(a[k][0][1] - a[k][1][1]) == (a[k][0][0] - a[k][1][0])*(a[k][2][1] - a[k][3][1]))
				cout << "YES" << endl;
			else
				cout << "NO" << endl;
		}
	}
    return 0;
}

C++: #include <iostream>
using namespace std;
 
 int main(void){
	 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;
	  if( (y2-y1)/(x2-x1) == (y4-y3)/(x4-x3) ) cout << "YES" << endl;
    else cout << "NO" << endl;
	 }
   return 0;
 }

C++: include <iostream>
#include <complex>
using namespace std;
typedef complex<double> xy_t;
double cross_product(xy_t a, xy_t b) { return (conj(a)*b).imag(); }
const double eps = 1e-11;
double x[4],y[4];
int N;
int main(int argc, const char * argv[]) {
    cin >> N;
    for(int t=0; t<N; ++t){
        for(int i=0; i<4; ++i){
            cin >> x[i] >> y[i];
        }
        xy_t a[2] ={
            xy_t(x[0],y[0]) - xy_t(x[1],y[1]),
            xy_t(x[2],y[2]) - xy_t(x[3],y[3])
        };
        bool p = abs(cross_product(a[0], a[1])) < eps;
        cout << (p ? "YES" : "NO") << endl;
        }
    return 0;
}

C++: #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*by)<eps/1000;

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