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 <algorithm>
#include <cmath>
#include <climits>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <cassert>
#include <functional>

using namespace std;

#define LOG(...) printf(__VA_ARGS__)
//#define LOG(...)
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define RSORT(c) sort((c).rbegin(),(c).rend())
#define CLR(a) memset((a), 0 ,sizeof(a))

typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int dx[] = { -1, 0, 1, 0 }; const int dy[] = { 0, 1, 0, -1 };

int main() {
	int n;
	cin>>n;
	while (n--){
		vector<pair<double, double>> pos(4);
		REP(i, 4){
			cin >> pos[i].first >> pos[i].second;
		}

		if (abs((pos[1].first - pos[0].first)*(pos[3].second - pos[2].second) - (pos[1].second - pos[0].second)*(pos[3].first - pos[2].first))<=0.00001)
			cout << "YES"<<endl;
		else
			cout << "NO"<<endl;
		
	}
}

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

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

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

C++: #include<stdio.h>

int main(void)
{
	double a[2]={0},b[2]={0},c[2]={0},d[2]={0},x1,x2,y1,y2;
	int i;
	scanf("%d",&i);//繰り返す回数の入力

	while(i!=0)
	{
		scanf("%lf %lf %lf %lf %lf %lf %lf %lf",&a[0],&a[1],&b[0],&b[1],&c[0],&c[1],&d[0],&d[1]);//入力した数の読み込み
		x1 = b[0]-a[0];   y1 = b[1]-a[1];//傾きを求めるのに必要な数を求める
		x2 = d[0]-c[0];   y2 = d[1]-c[1];
		if(x1==0 && x2==0)//傾き0のときは０で割ることができないため
			printf("YES\n");
		else if(x1==0 || x2==0)//片方が傾き0のとき
			printf("NO\n");
		else if(y1/x2 == y2/x2)//傾きが等しい＝平衡
			printf("YES\n");
		else //傾きが等しくない＝平衡ではない
			printf("NO\n");

		i-=1;
	}
 return 0;
}

C++: #include<stdio.h>

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++)
{
scanf("%lf %lf %lf %lf %lf %lf %lf %lf",&x1,&y1,&x2,&y2,&x3,&y3,&x4,&y4);
a1=(x1-x2)/(y1-y2);a2=(x3-x4)/(y3-y4);
if(a1==a2)printf("YES\n");
else printf("NO\n");
}
return 0;
}

C++: #include<iostream>
#include<string>
#include<vector>
#include<cstdio>
#include<sstream>
#include<algorithm>
#include<cmath>
#include<map>
#include<functional>
#include<queue>
#include<stack>
#include<set>
using namespace std;
#define SZ(n)  (int)n.size()
#define dump(x) cerr<<#x<<" = "<<(x)<<endl;
#define debug(x)cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define MP make_pair
#define PB push_back
	double EPS=0.0000000001;
	bool same(double a,double b){
		if(abs(a-b)<=EPS)return 1;
		else return 0;
	}
	
	
	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;
		double a1=(y2-y1)/(x2-x1);
		double a2=(y4-y3)/(x4-x3);
		if(same(a1,a2))cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
	}
	
	return 0;
}

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

int main(){
	int n;
	double x[4], y[4];
	int xi[4], yi[4];
	scanf("%d", &n);
	for(int i = 0; i < n; i++){
		scanf("%lf %lf %lf %lf %lf %lf %lf %lf", &x[0],&y[0],&x[1],&y[1],&x[2],&y[2],&x[3],&y[3]);

		for(int i = 0; i < 4; i++){
			xi[i] = (int)(x[i] * 100000);
			yi[i] = (int)(y[i] * 100000);
		}
		if((yi[0] - yi[1])*(xi[2] - xi[3]) == (xi[0] - xi[1])*(yi[2] - yi[3])){
			printf("YES\n");
		}else{
			printf("NO\n");
		}
	}
	return 0;
}

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

using namespace std;


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

	cin>>n;

	for(int i=0;i<n;i++)
	{
		cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
		AB=(y2-y1)/(x2-x1);
		CD=(y4-y3)/(x4-x3);

		if((fabs(AB-CD))<0.00001)
			cout<<"YES"<<endl;
		else
			cout<<"NO"<<endl;


	}
	

	return 0;
}

C++: #include <cmath>
#include <complex>
#include <vector>
#include <cfloat>
#include <algorithm>
#include<iostream>
using namespace std;


//二次元幾何テンプレート
//点クラス point->x,y
//直線クラス line->s,v
//
class point;
class line;
point vec_add(point vec1,point vec2);//ベクトルの足し算
point vec_sub(point vec1,point vec2);//ベクトルの引き算
double inner_product(point a,point b);//内積
double outer_product(point a,point b);//外積
bool vec_parallel(point vec1,point vec2);//ベクトルの並行判定(交差判定falseとしても使える)
bool vec_angle_right(point vec1,point vec2);//ベクトルの直行判定
bool cross_line_segment(line a,point p1,point p2);//直線と線分の交差判定
//


class point{
public:
	double x,y;
	point(){
		x=0;
		y=0;
	}
	point(double a,double b){
		x=a;
		y=b;
	}
};

//直線クラス
class line{
public:
	point s,v;
public:
	line(point a,point b){
		s=a;
		v=vec_sub(a,b);
	}
};

//多角形(頂点を保持する)
typedef vector<point> polygon;

//ベクトルの足し算
point vec_add(point vec1,point vec2){
	point res(vec1.x+vec2.x,vec1.y+vec2.y);
	return res;
}
//ベクトルの引き算
point vec_sub(point vec1,point vec2){
	point res(vec1.x-vec2.x,vec1.y-vec2.y);
	return res;
}
//内積
double inner_product(point a,point b){
	return a.x * b.x + a.y * b.y;
}
//外積
double outer_product(point a,point b){
	return a.x * b.y - a.y * b.x;
}


//ベクトルの並行判定
bool vec_parallel(point vec1,point vec2){
	if(outer_product(vec1,vec2)==0){
		return true;
	}else{
		return false;
	}
}
//ベクトルの直交判定
bool vec_angle_right(point vec1,point vec2){
	if(inner_product(vec1,vec2)==0){
		return true;
	}else{
		return false;
	}
}

bool cross_line_segment(line l,point p1,point p2){
	p1=vec_sub(p1,l.s);
	p2=vec_sub(p2,l.s);
	if(outer_product(p1,l.v)*outer_product(p2,l.v)<0){
		return true;
	}else{
		return false;
	}
}



//
int main(){
	int n;
	point p[4];
	cin>>n;
	for(;n--;){
		for(int i=0;i<4;i++){
			cin>>p[i].x;
			cin>>p[i].y;
		}
		p[0]=vec_sub(p[0],p[1]);
		p[2]=vec_sub(p[2],p[3]);
		if(vec_parallel(p[0],p[2])){
			cout<<"YES"<<endl;
		}else{
			cout<<"NO"<<endl;
		}
		
	}
	return 0;
}

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

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