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 <iostream>
#include <complex>
#include <vector>
#include <cmath>

#define rep(i,n) for(int i=0;i<n;i++)
#define EPS 1e-6

using namespace std;

typedef complex<double> P;

int main()
{
	int n;
	cin >> n;
	while(n--)
	{
		vector<P> p;
		rep(i,4)
		{
			double a,b;
			cin >> a >> b;
			p.push_back(P(a,b));
		}

		P a = p[1] - p[0];
		P b = p[3] - p[2];
		double t = a.real()*b.imag() - a.imag()*b.real();
		if(fabs(t) < EPS)
		{
			cout << "YES" << endl;
		}
		else
		{
			cout << "NO" << endl;
		}
	}
	return 0;
}

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

int main(int argc, char const* argv[]) {
  int n;
  cin >> n;
  for (int i = 0; i < n; i += 1) {
    float x1, y1, x2, y2, x3, y3, x4, y4;
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
    float AB, CD;
    AB = (x2-x1!=0)?(y2-y1)/(x2-x1):0;
    CD = (x4-x3!=0)?(y4-y3)/(x4-x3):0;
    if (AB == 0 && CD == 0) {
      float vAB = y2-y1, vCD = y4-y3;
      if (vAB == vCD) cout<<"YES"<<endl;
      else cout<<"NO"<<endl;
    } else {
      if (AB == CD) cout<<"YES"<<endl;
      else cout<<"NO"<<endl;
    }
  }
  return 0;
}

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

#define EPS 1e-10

int main() {
    int n; cin >> n;
    double x1, y1, x2, y2, x3, y3, x4, y4;
    for (int i = 0; i < n; i++) {
        cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
        if (abs(x1-x2) < EPS && abs(x3-x4) < EPS) {
            if (abs(x1-x3) > EPS) cout << "YES" << endl;
            else cout << "NO" << endl;
            continue;
        }

        double s1 = (y2-y1)/(x2-x1);
        double s2 = (y4-y3)/(x4-x3);
        if ( abs(s1-s2) < EPS ) {
            if ( abs((y1 - x1 * s1) - (y3 - x3 * s2)) < EPS ) {
                cout << "NO" << endl;
            } else {
                cout << "YES" << endl;
            }
        } else {
            cout << "NO" << endl;
        }
    }
    return 0;
}

C++: #include<stdio.h>
#include<string.h>
#include<iostream>

using namespace std;
double cross(long double x1,long double y1,long double x2,long double y2);

int main(){
	long double x1,y1,x2,y2;
	long double x3,y3,x4,y4;
	long double ans1,ans2;
	int n;
	cin>>n;
	for(int i=0;i<n;i++){
	cin>>x1>>y1>>x2>>y2;
	cin>>x3>>y3>>x4>>y4;
	ans1=cross(x1,y1,x2,y2);
	ans2=cross(x3,y3,x4,y4);
	//cout<<ans1<<" "<<ans2<<endl;
	if(ans1-ans2==0.0)
		cout<<"YES"<<endl;
	else 
		cout<<"NO"<<endl;
	}
}


double cross(long double x1,long double y1,long double x2,long double y2){
	return (x1-x2)/(y1-y2);
}

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

int main(){
	int n;cin >> n;
	double a[8];
	while(n--){
		for(int i = 0;i < 8;i++)cin >> a[i];
		double y1 = a[3]-a[1];double x1 = a[2]-a[0];
		double y2 = a[7]-a[5];double x2 = a[6]-a[4];
		double ans = y1/x1 - y2/x2;
		if(ans == 0)cout << "YES" << endl;
		else cout << "NO" << endl;
	}
	return 0; 
}

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

int main()
{
	const double EPS = 1e-10;
	const double PI = 4.*atan(1.);

	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;
		complex<double> A(x1,y1),B(x2,y2),C(x3,y3),D(x4,y4);
		double a = arg((A-B)/(C-D));
		cout << ( abs(a)<EPS || abs(a)>PI-EPS ? "YES" : "NO" ) << endl;
	}
	return 0;
}

C++: #include<stdio.h>
double x[4],y[4];
double X[2],Y[2];
double s[2];
int main()
{
    int n;
    scanf("%d",&n);
    for(int i=0;i<n;i++)
    {
         for(int j=0;j<4;j++)
         {
                scanf("%lf%lf",&x[j],&y[j]);
         }
         for(int j=0;j<2;j++)
         {
                (j==0)?X[j]=x[0]-x[1],Y[j]=y[0]-y[1]:X[j]=x[2]-x[3],Y[j]=y[2]-y[3];
         }
         for(int j=0;j<2;j++)
         {
                (Y[j]<0)?Y[j]=Y[j]*-1:Y[j]=Y[j]*1;
                s[j]=X[j]/Y[j];
         }
         (s[0]==s[1])?printf("YES\n"):printf("NO\n");
    }
    return 0;
}

C++: #include <iostream>
#include <stdio.h>
#include <cmath>

using namespace std;

int main()
{
	int n;
	double x1, y1, x2, y2, x3, y3, x4, y4;

	cin >> n;

	for (int i = 0; i < n; i++) {
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		//scanf("%lf %lf %lf %lf %lf %lf %lf %lf", &x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4);


#if 0
		// 線じゃなくて点の時
		if (x1 == x2 && y1 == y2) {
			cout << "NO" << endl;
		}
		// 線じゃなくて点の時
		if (x3 == x4 && y3 == y4) {
			cout << "NO" << endl;
		}

		// Y軸に平行な時
		if ( x2 - x1 == 0 && x4 - x3 == 0) {
			cout << "YES" << endl;
		}
		// X軸に平行な時
		if ( y2 - y1 == 0 && y4 - y3 == 0) {
			cout << "YES" << endl;
		}
#endif
		if ( abs((y2 - y1) *  (x4 - x3) - (y4 - y3) *  (x2 - x1)) < 0.0000000001 ) {
			cout << "YES" << endl;
		} else {
			cout << "NO" << endl;
		}
	}
	return 0;
}

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

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

		puts((y[1]-y[0])/(x[1]-x[0]) == (y[3]-y[2])/(x[3]-x[2])?"YES":"NO");
	}
	return 0;
}

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

using namespace std;

int N;
double X[4], Y[4];
long long ad, bc;

string parallel_judge(){
	ad = (X[1] * 100000 - X[0] * 100000)*(Y[3] * 100000 - Y[2] * 100000);
	bc = (Y[1] * 100000 - Y[0] * 100000)*(X[3] * 100000 - X[2] * 100000);
	if (ad - bc == 0){
		return "YES";
	}
	else{
		return "NO";
	}
}

int main()
{
	cin >> N;
	for (int i = 0; i < N; i++){
		for (int j = 0; j < 4; j++){
			cin >> X[j] >> Y[j];
		}
		cout << parallel_judge() << endl;
	}
}

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

using P = complex<long long>;

int cross(P p1, P p2) {
    return (p1.real() * p2.imag() - p1.imag() * p2.real());
}

int main() {
    int n;
    cin >> n;
    while (n--) {
	double x[4], y[4];
	for (int i = 0; i < 4; i++) cin >> x[i] >> y[i];
	P pp[4];
	for (int i = 0; i < 4; i++) pp[i] = P(x[i] * 100000, y[i] * 100000);
	if (cross(pp[1] - pp[0], pp[3] - pp[2]) == 0) {
	    cout << "YES" << endl;
	}
	else {
	    cout << "NO" << endl;
	}
    }
    return 0;
}

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

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

}

C++: #include<iostream>
#include<cmath>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
using namespace std;

int main(){
	double x[4],y[4],n;
	cin>>n;
	rep(i,n){
		rep(i,4)cin>>x[i]>>y[i];
		double vx=x[1]-x[0],vy=y[1]-y[0],ux=x[3]-x[2],uy=y[3]-y[2];
		double la=sqrt(vx*vx+vy*vy),lb=sqrt(ux*ux+uy*uy);
		if(abs(vx*ux+vy*uy-la*lb)<1e-6)cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
	}
	return 0;
}