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")
			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"

using namespace std;
using ll = long long;
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
	REP(i, v.size()) { if (i)os << " "; os << v[i]; }return os;
}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
	REP(i, v.size()) { if (i)os << endl; os << v[i]; }return os;
}

//誤差修正用
const double EPS = 1e-8;

//円周率
const double PI = acos(-1);

//double型の値が等しいか
inline bool eq(double a, double b) { return fabs(b - a) < EPS; }

//点に関する構造体
struct Point
{
	double x, y;

	Point() {}

	Point(double x, double y) : x(x), y(y) {}

	//加減、スカラー倍、乗算など
	Point operator+(const Point &b) const { return Point(x + b.x, y + b.y); }

	Point operator-(const Point &b) const { return Point(x - b.x, y - b.y); }

	Point operator*(const double b) const { return Point(x * b, y * b); }

	Point operator*(const Point &b) const { return Point(x * b.x - y * b.y, x * b.y + y * b.x); }

	Point operator/(const double b) const { return Point(x / b, y / b); }

	bool operator<(const Point &b) const { return x != b.x ? x < b.x : y < b.y; }

	bool operator==(const Point &b) const { return eq(x, b.x) && eq(y, b.y); }

	//大きさの二乗
	double norm() { return x * x + y * y; }

	//逆正接（x軸正方向からの反時計回り回転角）
	double arg() { return atan2(x, y); }

	//大きさ
	double abs() { return sqrt(norm()); }

	//反時計回りにθ回転
	Point rotate(double theta) { return Point(cos(theta) * x - sin(theta) * y, sin(theta) * x + cos(theta) * y); }

	//反時計回りにπ/2回転
	Point rotate90() { return Point(-y, x); }

	friend ostream &operator<<(ostream &os, Point &p) { return os << p.x << " " << p.y; }

	friend istream &operator>>(istream &is, Point &a) { return is >> a.x >> a.y; }
};

//外積
double cross(const Point &a, const Point &b)
{
	return a.x * b.y - a.y * b.x;
}

//内積
double dot(const Point &a, const Point &b)
{
	return a.x * b.x + a.y * b.y;
}

//直線に関する構造体
//直線が通る2点で表す
struct Line
{
	Point a, b;

	Line() {};

	Line(Point a, Point b) : a(a), b(b) {};

	friend ostream &operator<<(ostream &os, Line &p) { return os << "(" << p.a.x << "," << p.a.y << ") to (" << p.b.x << "," << p.b.y << ")"; }

	friend istream &operator>>(istream &is, Line &a) { return is >> a.a.x >> a.a.y >> a.b.x >> a.b.y; }
};

//多角形
typedef vector< Point > Polygon;

//3点の位置関係を判定
int ccw(const Point &a, Point b, Point c)
{
	b = b - a, c = c - a;

	//a→bで反時計回りの方向にc
	if (cross(b, c) > EPS) return +1;

	//a→bで時計回りの方向にc
	if (cross(b, c) < -EPS) return -1;

	//c→a→bで一直線
	if (dot(b, c) < 0) return +2;

	//a→b→cで一直線
	if (b.norm() < c.norm()) return -2;

	//a→c→bで一直線
	return 0;
}

//2直線の平行判定
bool IsParallel(const Line& a, const Line& b) {
	return abs(cross(a.b - a.a, b.b - b.a)) < EPS;
}

//点集合（多角形）の凸包を求める
//Andrew's Monotone Chain
//O(NlogN)（ソート依存）
Polygon Convex_Hull(Polygon& p) {
	int n = p.size(), k = 0;
	if (n >= 3) {
		sort(p.begin(), p.end());
		vector< Point > ch(2 * n);
		for (int i = 0; i < n; ch[k++] = p[i++]) {
			while (k >= 2 && cross(ch[k - 1] - ch[k - 2], p[i] - ch[k - 2]) < 0) --k;
		}
		for (int i = n - 2, t = k + 1; i >= 0; ch[k++] = p[i--]) {
			while (k >= t && cross(ch[k - 1] - ch[k - 2], p[i] - ch[k - 2]) < 0) --k;
		}
		ch.resize(k - 1);
		return ch;
	}
	else {
		return p;
	}
}

//2直線の交差判定
bool Intersect(const Line &l, const Line &m)
{
	return abs(cross(l.b - l.a, m.b - m.a)) > EPS || abs(cross(l.b - l.a, m.b - l.a)) < EPS;
}

//2直線の交点
Point Crosspoint(const Line &l, const Line &m)
{
	double A = cross(l.b - l.a, m.b - m.a);
	double B = cross(l.b - l.a, l.b - m.a);
	if (abs(A) < EPS && abs(B) < EPS) return m.a;
	return m.a + (m.b - m.a) * B / A;
}

#define curr(P, i) P[i]
#define next(P, i) P[(i+1)%P.size()]

//凸多角形の切断
//直線に対して左側にある部分（交点を含む）を返す
Polygon ConvexCut(Polygon &U, Line l)
{
	Polygon ret;
	for (int i = 0; i < U.size(); i++) {
		Point now = curr(U, i), nxt = next(U, i);
		if (ccw(l.a, l.b, now) != -1) ret.push_back(now);
		if (ccw(l.a, l.b, now) * ccw(l.a, l.b, nxt) < 0) {
			ret.push_back(Crosspoint(Line(now, nxt), l));
		}
	}
	return (ret);
}

//多角形の面積
//ただし返り値は求めたい値の2倍になっている
double Area2(const Polygon &p)
{
	double A = 0;
	for (int i = 0; i < p.size(); ++i) {
		A += cross(p[i], p[(i + 1) % p.size()]);
	}
	return A;
}

Point input_point() {
  double x, y;
  scanf("%lf %lf",&x,&y);
  return Point(x, y);
}

int main()
{
    int n;
    cin>>n;
    for(int i=0;i<2;++i){
        double x1,x2,x3,x4,y1,y2,y3,y4;
        Point a=input_point();
        Point b=input_point();
        Point c=input_point();
        Point d=input_point();
        if(IsParallel(Line(a,b),Line(c,d)))cout<<"YES"<<endl;
        else cout<<"NO"<<endl;
    }
}

C++: #include<iostream>
#include<algorithm>
#include<string>
using namespace std;
int main() {
	int n;
	cin >> n;
	for (int z = 0; z < n; z++) {
		long float x1, x2, x3,y1, y2, y3, y4, x4 ;
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		if (y1 > y2) {
			swap(y1, y2);
			swap(x1, x2);
		}
		if (y3 > y4) {
			swap(y3, y4);
			swap(x3, x4);
		}
		if ((x1 > x2&&x3 > x4 && ((y2 - y1) / (x1 - x2) == (y4 - y3) / (x3 - x4))) || (x2 > x1&&x4 > x3 && ((y1 - y2) / (x2 - x1) == (y3 - y4) / (x4 - x3)))) {
			cout << "YES" << endl;
		}
		else {
			cout << "NO" << endl;
		}
	}
}

C++: #include<iostream>
#include<string>
#include<vector>
#include<cstdio>
#include<sstream>
#include<algorithm>
#include<cmath>
#include<map>
#include<functional>
#include<queue>
#include<stack>
#include<set>
using namespace std;
#define SZ(n)  (int)n.size()
#define dump(x) cerr<<#x<<" = "<<(x)<<endl;
#define debug(x)cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define MP make_pair
#define PB push_back
	double EPS=0.0000001;
	bool same(double a,double b){
		if(fabs(a-b)<=EPS)return 1;
		else return 0;
	}
	
	
	int main(){
	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;
		double a1=(y2-y1)/(x2-x1);
		double a2=(y4-y3)/(x4-x3);
		if(same(a1,a2))cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
	}
	
	return 0;
}