Go: package main

import "fmt"

func abs(x float64) float64 {
	if x < 0 {
		return -x
	}
	return x
}

func main() {
	var n int
	var x1, y1, x2, y2, x3, y3, x4, y4 float64
	fmt.Scan(&n)
	for i := 0 ; i < n; i++ {
		fmt.Scanf("%f %f %f %f %f %f %f %f", &x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4)
		if abs((x2-x1)*(y4-y3) - (y2-y1)*(x4-x3)) < 1e-10 {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

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

using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,a) FOR(i,0,a)

const double ESP=1e-10;

double x[4],y[4];

int main(){
	int n;
	scanf("%d",&n);
	REP(i,n){
		REP(j,4){
			scanf("%lf %lf",&x[j],&y[j]);
		}
		if (fabs(x[0]-x[1])<=ESP || fabs(x[2]-x[3])<=ESP){
			if (fabs(x[0]-x[1])<=ESP && fabs(x[2]-x[3])<=ESP){
				printf("YES\n");
			}
			else{
				printf("NO\n");
			}
		}
		else{
			if (fabs((y[0]-y[1])/(x[0]-x[1])-(y[2]-y[3])/(x[2]-x[3]))<=ESP){
				printf("YES\n");
			}
			else{
				printf("NO\n");
			}
		}
	}
	return 0;
}

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

int main() {
	int t; scanf("%d", &t);
	for(int i = 0; i < t; 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 x5 = x2-x1;
		double y5 = y2-y1;
		double x6 = x4-x3;
		double y6 = y4-y3;
		double det = x5*y6-y5*x6;
		if(fabs(det)<0.00000001) printf("YES\n");
		else printf("NO\n");
	}
	return 0;
}

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

using namespace std;

typedef complex<double> P;

double const EPS = 1e-10;

double cross(P const& a, P const& b) {
  return imag(conj(a)*b);
}

bool is_parallel(P const& a1, P const& a2, P const& b1, P const& b2)
{ return abs(cross(a2-a1, b2-b1)) <= EPS; }

int main() {
  
  int N; cin >> N;
  for(int i=0; i<N; i++) {
    P ps[4];
    for(int i=0; i<4; i++)
      cin >> ps[i].real() >> ps[i].imag();
    printf("%s\n", (is_parallel(ps[0], ps[1], ps[2], ps[3]) ? "YES" : "NO" ));
  }
  
  return 0;
}

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

int main(){
	int N;
	double x1, y1, x2, y2, x3, y3, x4, y4;
	double dx1, dy1, dx2, dy2;
	
	cin >> N;
	
	for(int i = 0; i < N; i++){
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		dx1 = x2 - x1; dy1 = y2 - y1;
		dx2 = x4 - x3; dy2 = y4 - y3;
		if(dx1 * dy2 == dx2 * dy1) cout << "YES" << endl;
		else cout << "NO" << endl;
		
		//cout << dx1 * dy2 << " " << dx2 * dy1 << endl;
	}
	
	return 0;
}

C++: #include <algorithm>
#include <functional>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <climits>

#define all(c) (c).begin(), (c).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb(e) push_back(e)
#define mp(a, b) make_pair(a, b)
#define fr first
#define sc second

const int INF=100000000;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
using namespace std;
typedef pair<int ,int > P;
typedef long long ll;

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

        if((x1-x2)*(y3-y4)==(x3-x4)*(y1-y2)) {
            cout<<"YES"<<endl;
        }
        else {
            cout<<"NO"<<endl;
        }

    }
    return 0;
}

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

int main(){

	int n;
	cin>>n;
	double x1,y1,x2,y2,x3,y3,x4,y4;
	
	while(n>0){
		double a,b;
	cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
		
		a=(y2-y1)/(x2-x1);
		b=(y4-y3)/(x4-x3);
		
		if(a==b)
			cout<<"YES"<<endl;
		else
			cout<<"NO"<<endl;
n--;

	}
}

C++: #include<stdio.h>
int main(void)
{
    int n,i;
    double x1,x2,x3,x4,y1,y2,y3,y4,a,b;
    scanf("%d",&n);
        for(i=0;i<n;i++){
        scanf("%lf%lf%lf%lf%lf%lf%lf%lf",&x1,&y1,&x2,&y2,&x3,&y3,&x4,&y4);
        a=(y1-y2)/(x1-x2);
        b=(y3-y4)/(x3-x4);
        if(a==b)printf("YES\n");
        else if(a!=b)printf("NO\n");
    }
    return 0;
}

C++: #include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <stdio.h>
#include <algorithm>
#include <string.h>
#include <string>
#include <cmath>
#include <complex>
#include <map>
using namespace std;

#define rep(i,n) for(int i=0;i<int(n);++i)
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define EPS 1e-8
#define F first
#define S second

static const double PI=6*asin(0.5);
typedef long long ll;
typedef complex<double> CP;
typedef pair<double,double> P;
static const int INF=1<<24;

int main(){
	double x[3],y[3];
	int n;
	cin>>n;
	rep(i,n){
		rep(j,4){
			cin>>x[j]>>y[j];
			//cout<<x[j]<<" "<<y[j]<<endl;
		}
		P a( x[1]-x[0] ,y[1]-y[0]), b( x[3]-x[2] ,y[3]-y[2]);
		bool f;
		if(abs(a.F*b.S-b.F*a.S)<=EPS) f=true;
		else f=false;
		//CP c(3.0,2.0);
		//cout<<real(c)<<" "<<imag(c)<<endl;
		//cout<<real(a)<<" "<<imag(a)<<" "<<real(b)<<" "<<imag(b)<<endl;
		if(f) cout<<"YES\n";
		else cout<<"NO\n";
	}
	return 0;
}

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

int main(){
  int n;
  double x[4],y[4],dx[2],dy[2];
  cin >> n;
  for(int i=0;i<n;i++){
	for(int j=0;j<4;j++)cin >> x[j] >> y[j]; 
	dx[0] = x[0] - x[1];
	dx[1] = x[2] - x[3];
	dy[0] = y[0] - y[1];
	dy[1] = y[2] - y[3];
	if(dx[0]*dy[1] == dx[1]*dy[0]) 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;
}