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")
			continue
		}
		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, 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;
    }
}

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


int main(void) {

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

  return 0;
}

C++: #include<cstdio>
#include<cmath>
#include<iostream>
#include<algorithm>
using namespace std;
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;
		if(fabs((y2-y1)/(x2-x1)-(y4-y3)/(x4-x3))<0.0000000000001)cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
	}
	return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <deque>
#include <list>
#include <string>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>

using namespace std;

int n;
double x1,x2,x3,x4,ya1,y2,y3,y4;

int main() {
	cin >> n;

	for (int i = 0; i < n; i++) {
		cin >> x1 >> ya1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		if (x1 > x2) {
			double tmp = x1;
			x1 = x2;
			x2 = tmp;
			tmp = ya1;
			ya1 = y2;
			y2 = tmp;
		}
		if (x3 > x4) {
			double tmp = x3;
			x3 = x4;
			x4 = tmp;
			tmp = y3;
			y3 = y4;
			y4 = tmp;
		}

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

	return 0;
}

/*@@@@@@@@@@@@@@@@@@@@@@@@@*/
/*@                       @*/
/*@ debug output erased ? @*/
/*@                       @*/
/*@@@@@@@@@@@@@@@@@@@@@@@@@*/

C++: #include<iostream>
using namespace std;
#define dff 1e-9
int main(){
  int n;
  cin >>n;
  while(n--){
    double a[4][2],x;
    for(int i=0; i<4; i++) for(int j=0; j<2; j++) cin >>a[i][j];
    for(int i=0; i<2; i++) for(int j=0; j<2; j++) a[i*2][j]-=a[i*2+1][j];
    x = a[0][0]*a[2][1]-a[0][1]*a[2][0];
    if(-dff<x && x<dff) cout <<"YES"<<endl;
    else cout <<"NO"<<endl;
  }
  return 0;
}

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

using namespace std;

int main(void)
{
  double x,y,x2,y2;
  double x1,y1,x3,y3;
  int n;
  int i;
  long double a=0,b=0;
  int k=0;
  int j=0;

  cin>>n;

  for(i=0;i<n;i++)
    {
      cin>>x>>y>>x1>>y1;
      cin>>x2>>y2>>x3>>y3;

      a=(y1-y)*(x3-x2);
      j++;

      b=(y3-y2)*(x1-x);
      j++;


      if(a==b || ((x1-x)==0 && (x3-x2)==0) || ((y1-y)==0 && (y3-y2)==0))
        puts("YES");
      else
        puts("NO");
    }

}

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

int main()
{
    float a,s,d,f,g,h,j,k;
    float q,w,e,r;
        int n;
    cin>>n;
    for(int i=0; i<n; i++){
        cin>>a>>s>>d>>f>>g>>h>>j>>k;
        q=d-a;
    w=f-s;
    e=j-g;
    r=k-h;
        float key=q*r-w*e;
        if(!key)cout<<"YES"<<endl;
        else  cout<<"NO"<<endl;
    }
    return 0;
}

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

C++: #include<stdio.h>

int main()
{
	int n,x;
	double x1,y1,x2,y2,x3,y3,x4,y4,p,q;

	scanf("%d",&n);
	for(x=0;x<n;x++)
	{
		for(;;)
		{
			scanf("%lf %lf %lf %lf %lf %lf %lf %lf",&x1,&y1,&x2,&y2,&x3,&y3,&x4,&y4);
			if(x1>100||y1>100||x2>100||y2>100||x3>100||y3>100||x4>100||y4>100)
			{
			}
			else if(x1<-100||y1<-100||x2<-100||y2<-100||x3<-100||y3<-100||x4<-100||y4<-100)
			{
			}
			else
			{
				break;
			}
		}

		x2-=x1;
		y2-=y1;
		x1=0;
		y1=0;
		x4-=x3;
		y4-=y3;
		x3=0;
		y3=0;

		p=x2/y2;
		q=x4/y4;

		if(p==q)
		{
			printf("YES\n");
		}
		else
		{
			printf("NO\n");
		}
	}
	return 0;
}

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

using namespace std;

struct Vector {
  double x, y;
  Vector() {}
  Vector(double x, double y): x(x), y(y) {}
  Vector operator+(Vector v) { return Vector(x + v.x, y + v.y); }
  Vector operator-(Vector v) { return Vector(x - v.x, y - v.y); }
  Vector operator*(double k) { return Vector(x * k, y * k); }
  Vector operator/(double k) { return Vector(x / k, y / k); }
  bool operator==(Vector v)  { return abs(x - v.x) < 1e-10 && abs(y - v.y) < 1e-10; }
  friend void input(Vector &v) { cin >> v.x >> v.y; }
  friend double norm(Vector v) { return dot(v, v); }
  friend double  abs(Vector v) { return sqrt(norm(v)); }
  friend double   dot(Vector v1, Vector v2) { return v1.x * v2.x + v1.y * v2.y; }
  friend double cross(Vector v1, Vector v2) { return v1.x * v2.y - v1.y * v2.x; }
  friend void show(Vector v) { if (abs(v.x) < 1e-10) v.x = 0.0; if (abs(v.y) < 1e-10) v.y = 0.0; printf("%.10f %.10f\n", v.x, v.y); }
  friend bool ccw(Vector v, Vector v1, Vector v2) { return cross(v1 - v, v2 - v) > 1e-10; }
  friend bool  cw(Vector v, Vector v1, Vector v2) { return cross(v1 - v, v2 - v) < -1e-10; }
  friend bool parallel(Vector v1, Vector v2) { return abs(cross(v1, v2)) < 1e-10; }
  friend bool onLine(Vector v, Vector v1, Vector v2) { return v == v1 || v == v2 || (parallel(v1 - v, v2 - v) && dot(v1 - v, v2 - v) < -1e-10); }
  friend int direct(Vector v1, Vector v2, Vector v) { if (ccw(v1, v2, v)) return  1; if ( cw(v1, v2, v)) return -1; if (dot(v2 - v1, v - v1) < -1e-10) return  2; if (dot(v1 - v2, v - v2) < -1e-10) return -2; return 0; }
};
typedef Vector Point;

int main(void) {
  int n;
  cin >> n;

  for (int i = 0; i < n; i++) {
    Point p[4];
    for (int j = 0; j < 4; j++) {
      input(p[j]);
    }
    cout << (parallel(p[0] - p[1], p[2] - p[3]) ? "YES" : "NO") << endl;
  }

  return 0;
}