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

#define REP(i,n) for(ll i=0;i<ll(n);++i)
#define RREP(i,n) for(ll i=ll(n)-1;i>=0;--i)
#define FOR(i,m,n) for(ll i=m;i<ll(n);++i)
#define RFOR(i,m,n) for(ll i=ll(n)-1;i>=ll(m);--i)
#define ALL(v) (v).begin(),(v).end()
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());
#define DUMP(v) REP(aa, (v).size()) { cout << v[aa]; if (aa != v.size() - 1)cout << " "; else cout << endl; }
#define INF 1000000001ll
#define MOD 1000000007ll
#define EPS 1e-9

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


using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
ll max(ll a, int b) { return max(a, ll(b)); }
ll max(int a, ll b) { return max(ll(a), b); }
ll min(ll a, int b) { return min(a, ll(b)); }
ll min(int a, ll b) { return min(ll(a), b); }
///(´・ω・`)(´・ω・`)(´・ω・`)(´・ω・`)(´・ω・`)(´・ω・`)///


//誤差修正用
//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++]) {
			REP(i, ch.size()) {
				cout << ch[i] << endl;
			}
			cout << k << endl << i << endl << endl;
			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;
}

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	REP(i, n) {
		double x1, y1, x2, y2, x3, y3, x4, y4;
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		if(abs((x2-x1)*(y4-y3)-(x4-x3)*(y2-y1))<EPS)cout << "YES" << endl;
		else cout << "NO" << endl;
	}
}

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;
        cout << (((y2-y1)/(x2-x1) == (y4-y3)/(x4-x3))? "YES" : "NO") << endl;
    }
    return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
  int n;
  double x[4],y[4];
  
  cin >> n;
  
  while(n--){
    for(int i=0;i<4;i++){
      cin >> x[i] >> y[i];
    }
    
    double a = (y[0]-y[1])/(x[0]-x[1]);
    double b = (y[2]-y[3])/(y[2]-y[3]);
    
    if(a == b) cout << "YES" << endl;
    else cout << "NO" << endl;
  }
  
  return(0);
}

C++: #include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#define EPS 0.00000000001
using namespace std;

int main()
{
  double x1,x2,x3,x4,y1,y2,y3,y4;
  double dx1,dy1,dx2,dy2;
  int n;
  int i;

  cin>>n;
  for(i=0;i<n;i++){
    cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
    dx1=x2-x1;
    dy1=y2-y1;
    dx2=x4-x3;
    dy2=y4-y3;

    if(abs(dx1)<EPS && abs(dx2)<EPS)
      cout<<"YES"<<endl;
    else if(abs(dx1)<EPS || abs(dx2)<EPS)
      cout<<"NO"<<endl;
    else if(abs(dy1/dx1-dy2/dx2) < EPS)
      cout<<"YES"<<endl;
    else
      cout<<"NO"<<endl;
  }
}