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[4] == fpoints[6] {
			fmt.Println("YES")
		} else {
			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>
using namespace std;

int main()
{
	double a, b, c, d, e, f, g, h;
	int x;
	cin >> x;
	for(int p=0;p<x;p++)
	{
		cin >> a >> b >> c >> d >> e >> f >> g >> h;
		double i = (d - b) / (c - a);
		double j = (h - f) / (g - e);
		if (i == j) {
			cout << "YES" << endl;
		}
		else {
			cout << "NO" << endl;
		}
	}
	return 0;
}

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

int main()
{
	double a, b, c, d, e, f, g, h;
	int x;
	cin >> x;
	for(int p=0;p<x;p++)
	{
		cin >> a >> b >> c >> d >> e >> f >> g >> h;
		double i = (d - b) / (c - a);
		double j = (h - f) / (g - e);
		if (i == j) {
			cout << "YES" << endl;
		}
		else {
			cout << "NO" << endl;
		}
	}
	return 0;
}

C++:                                       
#include <iostream>
#include <cmath>
using namespace std;
int main(){


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

  }

  return 0;
}

C++: #include <iostream>
#include <complex>
#include <cmath>
using namespace std;
typedef complex<double> xy_t;
 
double cross_product(xy_t a, xy_t b) {
  return (conj(a) * b).imag();
}
 
const double eps = 1e-11;
double x[4], y[4];
int N;
int main() {
  cin >> N;
  for (int t = 0; t < N; ++t) {
    for (int i = 0; i < 4; ++i) {
      cin >> x[i] >> y[i];
    }
    xy_t a[2] = {
      xy_t(x[0], y[0]) - xy_t(x[1], y[1]),
      xy_t(x[2], y[2]) - xy_t(x[3], y[3])
    };
    bool p = abs(cross_product(a[0], a[1])) < eps;
    cout << (p ? "YES" : "NO") << endl;
  }
  return 0;
}

C++: #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>

using namespace std;

#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define fi first
#define se second

#define PI acos(-1.0)
#define INF 1000000007

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<double, double> PD;
typedef pair<string, ll> PS;
typedef vector<ll> V;

int n;
double x[100], y[100];

int main(){
	cin >> n;
	REP(i, n){
		REP(i, 4){
			cin >> x[i] >> y[i];
		}
		if ((y[0] - y[1]) / (x[0] - x[1]) == (y[2] - y[3]) / (x[2] - x[3])){
			cout << "YES\n";
		}
		else {
			cout << "NO\n";
		}
	}
}

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*x2-y2*x1;
		if(ans == 0)cout << "YES" << endl;
		else cout << "NO" << endl;
	}
	return 0; 
}

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

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

C++: #include <iostream>
#include <fstream>
#include <typeinfo>
#include <vector>
#include <cmath>
#include <set>
#include <map>
#include <string>
#include <algorithm>
#include <cstdio>
#include <queue>
#include <iomanip>
#include <cctype>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<25;
const double pi=acos(-1);
const double eps=1e-8;
const vi emp;

double add_double(double a,double b){
	if(abs(a+b)<eps*(abs(a)+abs(b))) return 0;
	return a+b;
}

struct point{
	double x,y;
	point operator+(point p){
		return point{add_double(x,p.x),add_double(y,p.y)};
	}
	point operator-(point p){
		return point{add_double(x,-p.x),add_double(y,-p.y)};
	}
	point operator*(double p){
		return point{x*p,y*p};
	}
	point operator/(double p){
		if(!p) return point{0,0}; 
		return point{x/p,y/p};
	}
	bool operator==(point p){
		return fabs(add_double(x,-p.x))<eps&&fabs(add_double(y,-p.y))<eps;
	}
	bool operator<(point p){
		if(fabs(x-p.x)>eps) return x<p.x;
		return y<p.y;
	}
};

typedef pair<point,point> pp;
typedef vector<point> VP;
const point O{0,0};

class Geom{
	public:
	double Length(point x,point y){
		point z=y-x;
		return sqrt(z.x*z.x+z.y*z.y);
	}
	double IP(point p,point q){
		return p.x*q.x+p.y*q.y;
	}
	double CP(point p,point q){
		return p.x*q.y-q.x*p.y;
	}
	string Counter_Clockwise(pp a,point x){
		point A=a.second-a.first;
		point X=x-a.first;
		double ip=IP(A,X),cp=CP(A,X),Al=Length(O,A),Xl=Length(O,X);
		if(cp>eps) return "Counter_Clockwise";
		if(cp<-eps) return "Clockwise";
		if(ip<-eps) return "Online_Back";
		if(Xl<Al||fabs(Xl-Al)<eps) return "On_Segment";
		return "Online_Front";
	}
	string Parallel_Orthogonal(pp a,pp b){
		point A=a.second-a.first,B=b.second-b.first;
		double ip=IP(A,B),cp=CP(A,B);
		string f=Counter_Clockwise(pp(a.first,a.second),b.first),s=Counter_Clockwise(pp(a.first,a.second),b.second);
		if(f[0]!='C'&&s[0]!='C') return "Agreement";
		if(cp<eps&&cp>-eps) return "Parallel";
		if(ip<eps&&ip>-eps) return "Orthogonal";
		else return "Commonly";
	}
	void Point_in(point& p){
		cin>>p.x>>p.y;
	}
};

int n;
VP p(4);
string s;

int main(){
	Geom geo;
	cin>>n;
	for(int i=0;i<n;i++){
		for(VP::iterator i=p.begin();i!=p.end();i++) geo.Point_in(*i);
		s=geo.Parallel_Orthogonal(pp(p[0],p[1]),pp(p[2],p[3]));
		if(s[0]=='P'||s[0]=='A') cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
	}
}

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

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

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

using namespace std;

int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    double 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);

    double v1x = x1 - x2, v1y = y1 - y2;
    double v2x = x3 - x4, v2y = y3 - y4;
    double prod = v1x * v2x + v1y * v2y;
    if (prod < 0.0) { prod *= -1.0; }

    double z1 = sqrt(v1x * v1x + v1y * v1y);
    double z2 = sqrt(v2x * v2x + v2y * v2y);

    puts(fabs(prod - z1 * z2) < 0.0000001 ? "YES" : "NO");
  }

  return 0;
}