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 <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstring>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <functional>
#include <sstream>
#include <complex>
using namespace std;

#define REP(i,a,n) for(int i=(a);i<(int)(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define mp make_pair
#define all(x) x.begin(),x.end()
#define EPS 1e-8

typedef complex<double> P;

bool equal(double d){
	return d<0.0+EPS && d>0.0-EPS ;
}
double cross(P a, P b){
	return a.real()*b.imag() - a.imag()*b.real();
}

int main(){
	int n;
	double x1, y1, x2, y2, x3, y3, x4, y4;
	scanf("%d",&n);
	while(n--){
		scanf("%lf%lf%lf%lf%lf%lf%lf%lf",&x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4);
		P A(x1,y1), B(x2,y2), C(x3,y3), D(x4,y4);
		if( equal(cross(A-B,C-D)) ){
			puts("YES");
		}else{
			puts("NO");
		}
	}
	return 0;
}

C++: #include<stdio.h>
#include<math.h>

int main()
{
	double x1, x2, x3, x4, y1, y2, y3, y4;
	int n, i;
	scanf("%d", &n);
	for (i = 0; i < n; i++)
	{
		scanf("%lf %lf %lf %lf %lf %lf %lf %lf", &x1, &x2, &x3, &x4, &y1, &y2, &y3, &y4);
		double a1 = ((y2 - y1) / (x2 - x1)), a2 = ((y4 - y3) / (x4 - x3));
		if (a1 == a2)
		{
			printf("YES\n");
			continue;
		}
		else
		{
			printf("NO\n");
			continue;
		}
	}
	return 0;
}

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

const int INF = 1e9 + 10;
const double eps = 1e-11;
double cross_product(complex<double> a, complex<double> b) {
  return (conj(a) * b).imag();
}

int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    vector<double> x(4), y(4);
    for (int j = 0; j < 4; j++) {
      cin >> x[j] >> y[j];
    }
    complex<double> vec1 = complex<double>{x[1] - x[0], y[1] - y[0]};
    complex<double> vec2 = complex<double>{x[3] - x[2], y[3] - y[2]};
    cout << ((abs(cross_product(vec1, vec2)) < eps) ? "YES" : "NO") << endl;
  }
}

C++: #include<cstdio>
using namespace std;
int main()
{
    double x1,x2,x3,x4,y1,y2,y3,y4;
    int i,j;
    scanf("%d",&i);
    for(i=0;i<j;i++)
    {
        scanf("%lf%lf%lf%lf%lf%lf%lf%lf",&x1,&y1,&x2,&y2,&x3,&y3,&x4,&y4);
        if((y2-y1)/(x2-x1)==(y4-y3)/(x4-x3))
            printf("YES\n");
        else printf("NO\n");
    }
    return 0;
}

C++: #include<iostream>
#include<sstream>
#include<algorithm>
#include<numeric>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<cstring>
#include<cassert>

#define rep(i,n) for(int i=0;i<n;i++)
#define all(c) (c).begin(),(c).end()
#define fr(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define mp make_pair
#define pb push_back
#define dbg(x) cerr<<#x<<" = "<<(x)<<endl

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;

const int inf=1<<28;
const double INF=1e12,EPS=1e-9;

int main()
{
  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;
    x2-=x1,y2-=y1;
    x4-=x3,y4-=y3;

    bool ok=abs(x2*y4-x4*y2)<EPS;
    cout<<(ok?"YES":"NO")<<endl;
  }
  return 0;
}

C++: #include <iostream>
#include <cmath>

using namespace std;
typedef pair<double, double> P;

void solve()
{
	P p[4];
	int n;
	cin >> n;
	while(n--)
	{
		cin >> p[0].first >> p[0].second >> p[1].first >> p[1].second >> p[2].first >> p[2].second >> p[3].first >> p[3].second;
		if(p[0].first == p[1].first && p[2].first == p[3].first)
		{
			cout << "YES" << endl;
		}
		else if(p[0].first == p[1].first || p[2].first == p[3].first)
		{
			cout << "NO" << endl;
		}
		else
		{
			double a1 = (p[1].second - p[0].second) / (p[1].first - p[0].first);
			double a2 = (p[3].second - p[2].second) / (p[3].first - p[2].first);
			if(a1 == a2)
			{
				cout << "YES" << endl;
			}
			else
			{
				cout << "NO" << endl;
			}
		}
	}
}

int main()
{
	solve();
	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
 
typedef long long ll;
typedef pair<int, int> ii;

#define EPS 1e-6 

int main(){

	int n;
	cin >> n;
	while(n--){
		double x1, x2,x3,x4,y1,y2,y3,y4;
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		double dot = (x1 - x2) * (y3 - y4) - (y1 - y2) * (x3 - x4);
		if(fabs(dot) < EPS) cout << "YES" << endl;
		else cout << "NO" << endl;
	}
	
	return 0;
}

C++: #include <cstdio>
#include <queue>
#include <algorithm>
#include <cmath>

#define rep(i, n) for(int i = 0; i < (n); ++i)

using namespace std;

int n;
double x[4];
double y[4];

int main(){
	scanf("%d", &n);
	rep(i, n){
		rep(j, 4){
			scanf("%lf%lf", x + j, y + j);
		}

		double dx[2];
		double dy[2];
		dx[0] = x[0] - x[1];
		dx[1] = x[2] - x[3];
		dy[0] = y[0] - y[1];
		dy[1] = y[2] - y[3];

		// printf("(%lf, %lf) (%lf, %lf)\n", dx[0], dy[0], dx[1], dy[1]);

		printf("%s\n", fabs(dx[0] * dy[1] - dx[1] * dy[0]) < 1e-12 ? "YES" : "NO");
	}
	return 0;
}

C++: #include <iostream>
#include <string>
#include <stdio.h>
using namespace std;
int main()
{
    int N;
	cin>>N;
	while(N--){
		bool ans;
		double x1,y1,x2,y2,x3,y3,x4,y4;
		cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
		double a,b;
		if(x1==x2){
			x3==x4?ans=true:ans=false;
		}else if(x3==x4){
			ans=false;
		}else{
			a=(y1-y2)/(x1-x2);
			b=(y3-y4)/(x3-x4);
			a==b?ans=true:ans=false;
		}
		ans?puts("YES\n"):puts("NO\n");
	}
    return 0;
}

C++: #include <iostream>

using namespace std;

typedef struct _POINT {
	double x;
	double y;
} POINT;

typedef struct _LINE {
	POINT a;
	POINT b;
} LINE;

bool isParallel (LINE l1, LINE l2) {
	double f1 = l1.b.x - l1.a.x;
	double g1 = l1.b.y - l1.a.y;
	double f2 = l2.b.x - l2.a.x;
	double g2 = l2.b.y - l2.a.y;

	double det = f2*g1 - f1*g2;
	if (det == 0)
		return true;
	else
		return false;
}

int main() {
	LINE ab, cd;
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> ab.a.x >> ab.a.y >> ab.b.x >> ab.b.y >> cd.a.x >> cd.a.y >> cd.b.x >> cd.b.y;
		if (isParallel(ab, cd))
			cout << "YES" << endl;
		else
			cout << "NO" << endl;
	}
	return 0;
}

C++: #include<bits/stdc++.h>

#define EPS 1.0e-10

using namespace std;

bool is_parallel(double ax, double ay, double bx, double by, double cx, double cy, double dx, double dy){
    double cp = (bx-ax)*(dy-cy) - (by-ay)*(dx-cx);
    return fabs(cp) < EPS;
}

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(is_parallel(x1,y1,x2,y2,x3,y3,x4,y4))
            cout << "YES" << endl;
        else
            cout << "NO" << endl;
    }

    return 0;
}