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<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<map>
#include<complex>
#include<cstdlib>
#include<cstring>
#include<string>
#include<vector>
#include<functional>

using namespace std;

const double EPS=1e-9;
const double INF=1e12;

typedef complex<double>Point;

namespace std{
    bool operator<(const Point &P,const Point &Q){
        return real(P)!=real(Q)?real(P)<real(Q):imag(P)<imag(Q);
    }
}

double dot(const Point &P,const Point &Q){
    return real(P)*real(Q)+imag(P)*imag(Q);
}

double cross(const Point &P,const Point &Q){
    return real(P)*imag(Q)-real(Q)*imag(P);
}

struct Line{
    Point a,b;
    Line(Point P,Point Q){
        a=P;b=Q;
    }
    Line(){}
};

struct Segment{
    Point a,b;
    Segment(Point P,Point Q){
        a=P;b=Q;
    }
    Segment(){}
};

struct Circle{
    Point c;
    double r;
    Circle(Point P,double l){
        c=P;r=l;
    }
};

typedef vector<Point>Polygon;

int ccw(Point A,Point B,Point C){
    B-=A;C-=A;
    if(cross(B,C)>0)return 1; //ccw
    if(cross(B,C)<0)return -1; //cw
    if(dot(B,C)<0)return 2; //c-b-a
    if(norm(B)<norm(C))return -2; //a-b-c
    return 0; //a-c-b
}
inline bool Parallelism(const Line &L,const Line &M){
    return fabs(cross(L.a-L.b,M.a-M.b))<EPS;
}

inline bool Parallelism(const Segment &S,const Segment &T){
    return fabs(cross(S.a-S.b,T.a-T.b))<EPS;
}

inline bool intersect(const Line &L,const Line &M){
    return cross(L.a-L.b,M.a-M.b)>EPS ||cross(L.a-L.b,M.a-M.b)<-EPS;
}

inline bool intersect(const Line &L,const Segment &S){
    return cross(L.b-L.a,S.a-L.a)*cross(L.b-L.a,S.b-L.a)<-EPS;
}

inline bool intersect(const Line &L,const Point &P){
    return abs(ccw(L.a,L.b,P))!=1;
}

inline bool intersect(const Segment &S, const Segment &T){
    return ccw(S.a,S.b,T.a)*ccw(S.a,S.b,T.b)<=0&&
        ccw(T.a,T.b,S.a)*ccw(T.a,T.b,S.b) <= 0;
}

inline bool intersect(const Segment &S,const Point &P){
    return ccw(S.a,S.b,P)==0;
}

inline bool intersect(const Circle &C,const Point &P){
    return abs(C.c-P)<=C.r+EPS;
}

inline bool intersect(const Circle &C,const Circle &D){
    return abs(C.c-D.c)<=C.r+D.r&&abs(C.c-D.c)>=fabs(C.r-D.r);
}

inline Point crossPoint(const Line &L,const Line &M){

}
double areaTriangle(Point A,Point B,Point C){
    B-=A;C-=A;
    return fabs(cross(B,C))*0.5;
}

double areaPolygon(Polygon &g){
    const int Sz=g.size();
    if(Sz<3)return 0;
    if(Sz==3)return areaTriangle(g[0],g[1],g[2]);

    double res=cross(g[Sz-1],g[0]);
    for(int i=1;i<Sz;i++)res+=cross(g[i-1],g[i]);

    return fabs(res)*0.5;
}



int main(){
    int N;
    Line L,M;
    cin>>N;
    while(N--){
        cin>>L.a.real()>>L.a.imag()>>L.b.real()>>L.b.imag();
        cin>>M.a.real()>>M.a.imag()>>M.b.real()>>M.b.imag();
        if(Parallelism(L,M))cout<<"YES"<<endl;
        else cout<<"NO"<<endl;
    }
    return 0;
}

C++: #include<iostream>
#include<complex>
using namespace std;
int main(){
    int time;
    cin>>time;
    for(int i=0;i<time;++i){
        float a,b,c,d;
        cin>>a>>b>>c>>d;
        complex<float> x(a-c,b-d);
        cin>>a>>b>>c>>d;
        complex<float> y(a-c,b-d);
        y = conj(y);
        complex<float> z = x*y;
        if(z.imag()==0){
            cout<<"YES"<<endl;
        }else{
            cout<<"NO"<<endl;
        }
    }
    return 0;
}

C++: #include <iostream>
using namespace std;
int main(void)
{
    double x[4];
    double y[4];
    int n;
    cin >> n;
    while(n--){
        for(int i=0; i<4; i++){
            cin >> x[i] >> y[i];
        }
        double d1,d2;
        d1 = (y[1]-y[0])/(x[1]-x[0]);
        d2 = (y[3]-y[2])/(x[3]-x[2]);
        if(d1==d2) cout << "YES" << endl;
        else cout << "NO" << endl;
    }
    return 0;
}

C++: #include <iostream>
#include <cmath>
using namespace std;
int main(void) {
  int n;
  double x1, y1, x2, y2, x3, y3, x4, y4;
  cin >> n;
  while (n--) {
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
    if ((y1 - y2) / (x1 - x2) == (y3 - y4) / (x3 - x4)) {
      cout << "YES";
    } else {
      cout << "NO";
    }
    cout << endl;
  }
  return 0;
}

C++: #include <iostream>
#include <complex>
using namespace std;
typedef complex<double> P;
const double EPS = 1e-9;
int main(){
	int N;
	cin >> N;
	while(N--){
		P a,b,c,d;
		cin >> a.real() >> a.imag() >> b.real() >> b.imag() >> c.real() >> c.imag() >> d.real() >> d.imag();
		P one = a-b;
		P two = c-d;
		bool f = false;
		if( abs(one.imag()) < EPS || abs(two.imag()) < EPS ){
			f = abs(one.imag()) < EPS && abs(two.imag()) < EPS;
		}else{
			f = abs(one.real()/one.imag() - two.real()/two.imag()) < EPS;
		}
		cout << (f?"YES":"NO") << endl;
	}
}

C++: #include<iostream>
#include<queue>
#include<string>
#include<stack>
#include<cstdio>
#include<algorithm>

using namespace std;

int main(void)
{
  double x,y;
  double x1,y1;
  int n;
  int i;
  long double a=0,b=;
  int k1=0,k2=2;

  cin>>n;

  for(i=0;i<n;i++)
    {
      cin>>x>>y>>x1>>y1;
      if(x1-x!=0)
        a=(y1-y)/(x1-x);
      else
        a=1000;

      cin>>x>>y>>x1>>y1;
      if(x1-x!=0)
        b=(y1-y)/(x1-x);
      else
        b=1000;

      if(a==b)
        puts("YES");
      else
        puts("NO");
    }

}

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

//#define PI 3.141592653589

using namespace std;



int main()
{
	/*
	int n, a, min=1000000, max=-1000000;
	long sum=0;
	
	cin >> n;
	for (int i=0; i<n; i++)
	{
		cin >> a;
		if (a < min) min = a;
		if (a > max) max = a;
		sum += a;
	}
	cout << min << " " << max << " " << sum << endl;
	*/
	
	int n;
	double x1, y1, x2, y2, x3, y3, x4, y4;
	double katamuki1, katamuki2;
	
	cin >> n;
	for (int i=0; i<n; i++)
	{
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		katamuki1 = (y2-y1) / (x2-x1);
		katamuki2 = (y4-y3) / (x4-x3);
		if (katamuki1 == katamuki2) cout << "YES" << endl;
		else cout << "NO" << endl;
	}
	
	return 0;
}

C++: #include<iostream>
using namespace std;
#define rep(i,a) for(int i = 0 ; i < a ;  i++)
int main(void){
	int n;
	cin>>n;
	rep(k,n){
		float x[4];
		float y[4];
		float ans[2];
		rep(i,4)cin>>x[i]>>y[i];
		rep(i,2)ans[i] = (x[i+2] - x[i]) * (y[i+2]-y[i]);
		if(ans[0]==ans[1])cout<<"YES";
		else cout<<"NO";
		cout<<endl;
	}
}

C++: #include<iostream>
#include<cmath>
using namespace std;
#define EPS 1e-10
 
double a,b,c,d,e,f,g,h;
double det(){
    double dx1,dy1,dx2,dy2;
    dx1 = a-c;
    dy1 = b-d;
    dx2 = e-g;
    dy2 = f-h;
    return dx1*dy2 - dy1*dx2;
}
int main(){
    int n;
    cin>>n;
    while(n--){
        cin>>a>>b>>c>>d>>e>>f>>g>>h;
        cout<<(fabs(det())<EPS?"YES":"NO")<<endl;
    }
    return 0;
}

C++: #include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define int long long
using namespace std;
typedef pair<int, int> P;

const int INF = 1e8;
const double EPS = 1e-10;

signed main(){
    int n;
    cin >> n;
    double x[4], y[4];
    rep(i, 0, n){
        rep(j, 0, 4){
            cin >> x[j] >> y[j];
        }
        double h1, h2;
        if(fabs(x[1] - x[0] < EPS)) h1 = INF;
        else h1 = (y[1] - y[0]) / (x[1] - x[0]);
        if(fabs(x[3] - x[2]) < EPS) h2 = INF;
        else h2 = (y[3] - y[2]) / (x[3] - x[2]);
        if(fabs(h1 - h2) < EPS) cout << "YES" << endl;
        else cout << "NO" << endl;
    }
}