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<stdio.h>
#include<iostream>
using namespace std;
int main(){

int n;
double x1,x2,x3,x4,y1,y2,y3,y4;
double a1=0,a2=0;
scanf("%d",&n);

for(int i=0;i<n;i++)
{
cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
a1=(y2-y1)/(x2-x1);a2=(y3-y4)/(x3-x4);
if(a1==a2)cout<<"YES"<<endl;
else cout<<"NO"<<endl;
}

return 0;
}

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

int main()
{
    int n;
    cin>>n;
    while(n--){
        pair<double,double>a[4];
        for(int i=0;i<4;i++){
            cin>>a[i].first>>a[i].second;
        }
        if(abs((a[1].first-a[0].first)*(a[3].second-a[2].second)-(a[3].first-a[2].first)*(a[1].second-a[0].second))<1e-10)
            cout<<"YES"<<endl;
        else
            cout<<"NO"<<endl;
    }
    return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
using uint = unsigned int;
using lint = long long int;
using ulint = unsigned long long int;
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;
template<class T, class U> void assign(V<T>& v, int n, const U& a) { v.assign(n, a); }
template<class T, class... Args> void assign(V<T>& v, int n, const Args&... args) { v.resize(n); for (auto&& e : v) assign(e, args...); }


int main() {
  cin.tie(nullptr); ios_base::sync_with_stdio(false);
  int n; cin >> n;
  for (int _ = 0; _ < n; ++_) {
    double xa, ya, xb, yb; cin >> xa >> ya >> xb >> yb;
    double th0 = atan2(yb - ya, xb - xa);
    double xc, yc, xd, yd; cin >> xc >> yc >> xd >> yd;
    double th1 = atan2(yd - yc, xd - xc);
    cout << (abs(tan(th1) - tan(th0)) < 1e-10 ? "YES" : "NO") << '\n';
  }
}

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

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

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;

        if( !((x1-x2)*(y3-y4)-(y1-y2)*(x3-x4)) ) cout << "YES\n";
        else cout << "NO\n";
    }

    return 0;
}

C++: #include <iostream>
#include <stdio.h>
using namespace std;
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;
		(y1-y2)*(x3-x4)==(y3-y4)*(x1-x2)?puts("YES"):puts("NO");
	}
    return 0;
}

C++: #include <iostream>
#include <iomanip>
#include <cassert>
#include <algorithm>
#include <functional>
#include <vector>
#include <string>
#include <cstring>
#include <stack>
#include <queue>
#include <map>
#include <bitset>
#include <sstream>
#include <istream>
#include <cmath>
#include <cstdio>

using namespace std;

#define vci vector<int>
#define vcs vector<string>
#define pb push_back
#define sz size()
#define mapci map<char, int>
#define mapsi map<string, int>
#define all(x) x.begin(), x.end()

#define for_(i, a, b) for (int i=(int)a; i<(int)b; i++)
#define for_d(i, a, b) for (int i=(int)a-1; i>=b; i--)
#define for_r(i, a, b, c) for (int i=(int)a; i<(int)b; i += c)
#define for_dr(i, a, b, c) for (int i=(int)a-1; i>=b; i -= c)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

#define vcitr vector<int>::iterator
#define vcsitr vector<string>::iterator
#define mapcitr map<char, int>::iterator
#define mapsitr map<string, int>::iterator

typedef long long ll;

const int iINF = 2147483647;
const ll lINF = 9223372036854775807;

template <class T> inline void dbg(T t) { cout << t << endl; }


struct Point2D { 
	double x, y;
	Point2D (double a=0, double b=0) { x=a; y=b; }
};

typedef Point2D Vector2D;

double dist2D(const Point2D& a, const Point2D& b) { return sqrt( (a.x-b.x)*(a.x-b.x) + (a.y-b.y)*(a.y-b.y) ); }

Vector2D sub_vector2D(const Vector2D& a, const Vector2D& b) {
	Vector2D ret;
	ret.x = a.x - b.x; ret.y = a.y - b.y;
	return ret;
}

double cross_product(const Vector2D& a, const Vector2D& b) { return a.x*b.y - a.y*b.x; }

double inner_product(const Vector2D& a, const Vector2D& b) { return a.x*b.x + a.y*b.y; }

int main() {
	int n; cin >> n;
	Point2D a, b, c, d;
	Vector2D x, y;
	
	for (int i=0; i<n; i++) {		
		cin >> a.x >> a.y >> b.x >> b.y >> c.x >> c.y >> d.x >> d.y;
		
		x = sub_vector2D(b, a); y = sub_vector2D(d, c);
		
		if (cross_product(x, y) < 1e-10) cout << "YES" << endl;
		else cout << "NO" << endl;
	}
	
	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;

#define REP(i, s, n) for (int i = s; i < n; ++i)
#define rep(i, n) REP(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define IINF INT_MAX
#define LLINF LLONG_MAX
#define DEBUG false

int main()
{
    int n;
    pair<double, double> pa;
    vector<pair<double, double> > a;
    vector<pair<double, double> > b;
    cin >> n;
    rep(j, n)
    {
        rep(i, 2)
        {
            cin >> pa.first;
            cin >> pa.second;
            a.push_back(pa);
        }
        rep(i, 2)
        {
            cin >> pa.first;
            cin >> pa.second;
            b.push_back(pa);
        }
        SORT(a);
        SORT(b);
        double anglea = (a[1].second - a[0].second) / (a[1].first - a[0].first);
        double angleb = (b[1].second - b[0].second) / (b[1].first - b[0].first);
        if(DEBUG) cout<<anglea<<" "<<angleb<<endl;
        if (fabsl(anglea - angleb) < 0.0000001)
        {
            cout << "YES" << endl;
        }
        else
        {
            cout << "NO" << endl;
        }
        a.clear();
        b.clear();
    }
    return 0;
}

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

int main()
{
    int n;
    cin >> n;
    for(int i=0; i<n; i++)
    {
        double x1, x2, x3, x4;
        double y1, y2, y3, y4;
        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 <cstdio>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string.h>
#include <queue>
#include <stack>
#include <utility>
#include <queue>
#define mp make_pair
#define pii pair<int,int> 
#define ff first
#define ss second

using namespace std;

double x1,x2,x3,x4,y1,y2,y3,y4;
double g1,g2;
int tc;

int main()
{
	scanf("%d",&tc);
	while(tc--)
	{
		scanf("%lf %lf %lf %lf %lf %lf %lf %lf",&x1,&y1,&x2,&y2,&x3,&y3,&x4,&y4);
		g1=(y2-y1)/(x2-x1);
		g2=(y4-y3)/(x4-x3);
		if(g1==g2)
		{
			printf("YES\n");
		}
		else
		{
			printf("NO\n");
		}
		//printf("%.2lf,%.2lf\n",g1,g2);
	}
	return 0;
}