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[1] == fpoints[3] {
			fmt.Println("YES")
			continue
		}
		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 "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;

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

C++: #include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <string>

using namespace std;

int main() {

	int n;
	double x[4] = { 0 }, y[4] = { 0 }, ans[2] = { 0 };

	cin >> n;

	for (int i = 0; i < n; i++) {
		for (int j = 0; j < 4; j++) {
			cin >> x[j] >> y[j];
		}
		ans[0] = (y[1] - y[0]) / (x[1] - x[0]);
		ans[1] = (y[3] - y[2]) / (x[3] - x[2]);
		if (ans[0] == ans[1])
			cout << "YES" << endl;
		else
			cout << "NO" << endl;
	}

	return 0;
}

C++: #include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<ctime>
#include<cctype>
#include<climits>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<memory>
#include<functional>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;

typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<double> vd;
typedef pair<int, int> pii;
typedef pair<long, long> pll;
typedef long long ll;

int dy[] = { 0, 0, 1, -1, 0 };
int dx[] = { 1, -1, 0, 0, 0 };

int main(){
	ios::sync_with_stdio(false);

	int n;
	scanf("%d", &n);

	double a[2], b[2], c[2], d[2];
	double e=0.00000001;


	while(n--){
		scanf("%lf %lf %lf %lf %lf %lf %lf %lf", &a[0], &a[1], &b[0], &b[1], &c[0], &c[1], &d[0], &d[1]);

		double l1, l2;
		bool p=false;

		if((fabs(a[0]-b[0])<e)&&(fabs(c[0]-d[0])<e)){
			p=true;
		}else if((fabs(a[0]-b[0])>e)&&(fabs(c[0]-d[0])>e)){
			l1=(b[1]-a[1])/(b[0]-a[0]);
			l2=(d[1]-c[1])/(d[0]-c[0]);

			if(fabs(l2-l1)<e)	p=true;
		}

		if(p){
			printf("YES\n");
		}else{
			printf("NO\n");
		}
	}

}

C++: #include <complex>
#include <cmath>
#include <stdio.h>
#include <iostream>
using namespace std;
typedef complex<double> xy_t;
const double eps = 1e-11;
double x[4], y[4];
int N;

double cross_product(xy_t a,xy_t b) {
  return (conj(a)*b).imag()/2.0;
}

int main() {
  cin >> N; //????????°
  for (int t=0; t<N; ++t) {
    for (int i=0; i<4; ++i)
      cin >> x[i] >> y[i]; //x0,y0,...,x3,y3
    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;
  }
}

C++: #include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=n;i>=0;i--)
#define all(v) v.begin(),v.end()
template<typename T>T rad(T deg){return deg*M_PI/180;}
template<typename T>bool eq(T a,T b){return ((a-b)<=1e-8)?true:false;}
using namespace std;
int main() {
    int n;
    cin >> n;
    rep(j,n) {
        complex<double> a[4];
        rep(i, 4) {
            double x, y;
            cin >> x >> y;
            a[i] = *(new complex<double>(x, y));
        }
        complex<double> vAB = a[0] - a[1];
        complex<double> vCD = a[2] - a[3];
        if (eq(vAB.real(), 0.0)) {
            cout << ((eq(vCD.real(), 0.0)) ? "YES" : "NO") << endl;
        } else if(eq(vCD.real(),0.0)){
            cout << ((eq(vAB.real(), 0.0)) ? "YES" : "NO") << endl;
        }else{
            double m1 = vAB.imag() / vAB.real();
            double m2 = vCD.imag() / vCD.real();
            cout << ((eq(m1, m2)) ? "YES" : "NO") << endl;
        }
    }
}

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

const double EPS = 1e-8;

double outp(double x1, double y1, double x2, double y2) {
  return x1*y2 - y1*x2;
}

int sig(double x) {
  if(x < -EPS) return -1;
  if(x > +EPS) return +1;
  return 0;
}

int main() {
  int N; cin >> N;
  while(N--) {
    double x1, y1, x2, y2, x3, y3, x4, y4;
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
    x2 -= x1; y2 -= y1;
    x4 -= x3; y4 -= y3;
    if(sig(outp(x2, y2, x4, y4)) == 0) {
      cout << "YES" << endl;
    }
    else {
      cout << "NO" << endl;
    }
  }
}