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(int i=0; i<(int)(n); ++i)

using namespace std;

typedef complex<double> Point;

const double EPS = 1e-5;

int sign(double x){
    if(x > EPS) return 1;
    if(x < -EPS) return -1;
    return 0;
}
struct Line : public vector<Point> {
    Line(const Point& a, const Point& b) {
        push_back(a); push_back(b);
    }
    Point vector() const {
        return back() - front();
    }
};

double cross(Point a, Point b){
    return imag(conj(a) * b);
}

bool paralell(Line l, Line m){
    return sign(cross(l.vector(), m.vector())) == 0;
}

int main(){
    int N;
    cin >> N;
    while(N--){
        Point p[4];
        REP(i, 4){
            double x, y;
            cin >> x >> y;
            p[i] = Point(x, y);
        }
        Line l1(p[0], p[1]);
        Line l2(p[2], p[3]);
        if(paralell(l1, l2)){
            cout << "YES" << endl;
        }else{
            cout << "NO" << endl;
        }
    }
    return 0;
}

C++: #include <stdio.h>

int main(){
    int n,i,j;
    double x[5],y[5];
    long long X[5],Y[5];
    scanf("%d",&n);
    for(i=0;i<n;i++){
        for(j=1;j<=4;j++){
            scanf("%lf %lf",&x[i],&y[i]);
            X[i] = (int)(x[i]*1000000);
            Y[i] = (int)(y[i]*1000000);
        }
        if((X[2]-X[1])*(Y[4]-Y[3])-(X[4]-X[3])*(Y[2]-Y[1])){
            printf("NO\n");
        }else{
            printf("YES\n");
        }
    }
}

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

typedef double dbl;
dbl x[4], y[4];

bool parallelism() {
	if (x[0] == x[1]) {
		if (x[2] == x[3]) return true;
		else return false;
	}
	else {
		if (x[2] == x[3]) return false;
		else {
			dbl k12 = (y[1] - y[0]) / (x[1] - x[0]);
			dbl k34 = (y[3] - y[2]) / (x[3] - x[2]);
			if (fabs(k12 - k34) < 1e-10) return true;
			else return false;
		}
	}
}
int main() {
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < 4; j++) {
			cin >> x[j] >> y[j];
		}
		if (parallelism()) cout << "YES\n";
		else cout << "NO\n";
	}
}

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

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

using namespace std;
 
int main(){
	int n;
	double x[6],y[6];

	cin >>n;
	while(n--){
		cin >>x[0]>>y[0]>>x[1]>>y[1]>>x[2]>>y[2]>>x[3]>>y[3];
		
		x[4]=x[0]-x[1];
		y[4]=y[0]-y[1];
		x[5]=x[2]-x[3];
		y[5]=y[2]-y[3];

		if(x[4]*y[5]-x[5]*y[4]) cout<< "NO" << endl;
		else cout<<"YES" << endl;
    }
 
    return 0;
}

C++: #include <iostream>
using namespace std;
int main()
{
    int n;cin>>n;
    for(int i=0;i<n;++i){
        double abdx,abdy,cddx,cddy;
        double x[4];
        double y[4];
        for(int j=0;j<4;++j){
            cin>>x[j]>>y[j];
        }
        x[0]>x[1]?abdx=x[0]-x[1]:abdx=x[1]-x[0];
        x[2]>x[3]?cddx=x[2]-x[3]:cddx=x[2]-x[3];
        y[0]>y[1]?abdy=y[0]-y[1]:abdy=y[1]-y[0];
        y[2]>y[3]?cddy=y[2]-y[3]:cddy=y[2]-y[3];
        if((abdy/abdx)==(cddy/cddx))cout<<"yes"<<endl;
        else cout<<"NO"<<endl;
    }
}

C++: #include<cstdio>
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<map>
#include<stack>
#include<cstring>
#include<cstdlib>

using namespace std;

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

int main(){
	
	int n;
	cin>>n;
	
	rep(t,n){
		double x[4];
		double y[4];
		
		rep(i,4){
			cin>>x[i]>>y[i];
		}
		
		double dx1 = x[0]-x[1];
		double dx2 = x[2]-x[3];
		
		double dy1 = y[0]-y[1];
		double dy2 = y[2]-y[3];
		
		
		if(dx1==0){
			if(dx2==0)puts("YES");
			else puts("NO");
		}else{
			double a1 = dy1/dx1;
			double a2 = dy2/dx2;
			if(fabs(a1-a2)<0.000000001)puts("YES");
			else puts("NO");
		}
	}
}

C++: #include<iostream>
#include <fstream>
#include <stdio.h>
#include <stdlib.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include<string>
#include<vector>
#include<cmath>
#include<stack>
#include<queue>
#include<sstream>
#include<algorithm>
#include<map>
#include<complex>
using namespace std;


#define li			long long int
#define rep(i,to)	for(int i=0;i<((int)(to));i++)
#define repp(i,start,to)	for(int i=(int)(start);i<((int)(to));i++)
#define pb			push_back
#define sz(v)		((li)(v).size())
#define bgn(v)		((v).begin())
#define eend(v)		((v).end())
#define allof(v)	(v).begin(), (v).end()
#define dodp(v,n)		memset(v,(li)n,sizeof(v))
#define bit(n)		(1ll<<(li)(n))
#define mp(a,b)		make_pair(a,b)
#define rin	rep(i,n)
#define EPS 1e-10
#define ETOL 1e-8
#define MOD 1000000007
#define F first
#define S second
#define p2(a,b)		cout<<a<<"\t"<<b<<endl
#define p3(a,b,c)		cout<<a<<"\t"<<b<<"\t"<<c<<endl

typedef long double Real;
typedef complex<Real> Point;
typedef pair<Point, Point> Line;
typedef pair<Point, Real> Circle;
typedef vector<Point> Poly;

Real eps = 1e-9;

inline istream& operator>>(istream& s, Point& p) {return s >> p.real() >> p.imag();}
inline bool near(const Point& p, const Point& q){return abs(p - q) < eps;}
inline Real dot(const Point& p, const Point& q){return p.real() * q.real() + p.imag() * q.imag();}
inline Real cross(const Point& p, const Point& q){return p.real() * q.imag() - p.imag() * q.real();}

// ccw_b : old version of ccw.
inline Real ccw_b(const Point& p, const Point& q, const Point& r) {return cross(q - p, r - p);}

/* ccw :
CD  : counter direction
CW  : clock wise
OS  : on segment
CCW : counter clock wise
D   : direction
 */
enum LPposit { P_CD = -2, P_CW = -1, P_OS = 0, P_CCW = 1, P_D = 2};
LPposit ccw(const Point& p, const Point& q, const Point& r) {
  Real c = ccw_b(p, q, r);
  if (c < -eps) return P_CW;
  if (c >  eps) return P_CCW;
  if (dot(q - p, r - p) < -eps) return P_CD;
  if (dot(p - q, r - q) < -eps) return P_D;
  return P_OS;
}


double a[8];

Point normal(Point p){
	if(p.real()==0)return Point(0,0);
	else return Point(1,p.imag()/p.real());
}

void solve(){
	Line l1(mp(Point(a[0],a[1]),Point(a[2],a[3])));
	Line l2(mp(Point(a[4],a[5]),Point(a[6],a[7])));
	Point d1=l1.S-l1.F;
	Point d2=l2.S-l2.F;
	
	if(normal(d1).imag()==normal(d2).imag()) puts("YES");
	else puts("NO");
}

int main(){
	li n;
	cin>>n;
	
	rin{
		rep(i,8)cin>>a[i];
		solve();
	}
	
	return 0;
}

C++: #include <iostream>
using namespace std;
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] ;
		double lnx[2],lny[2];
		lnx[0]=x[1]-x[0], lnx[1]=x[4]-x[3];
		lny[0]=y[1]-y[0], lny[1]=y[4]-y[3];
		if(lnx[0]*lny[1]==lnx[1]*lny[0]) cout << "YES\n" ;
		else cout << "NO\n" ;
	}
}