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)
		}
		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 <cstdio>
#include <bitset>
#include <cmath>
#include <complex>
#include <vector>
#include <algorithm>
#include <stack>
#include <iostream>
#define EPS 1e-6

using namespace std;
typedef complex<double> coor;

double cross(coor a, coor b)
{
  return a.real() * b.imag() - a.imag() * b.real();
}

double dot(coor a, coor b)
{
  return a.real() * b.real() + a.imag() * b.imag();
}

int main()
{
  int N;
  scanf(" %d ", &N);
  
  for (int i = 0; i < N; i++) {
    coor c[4];
    for (int j = 0; j < 4; j++) {
      double x, y;
      scanf(" %lf %lf ", &x, &y);
      c[j] = coor(x, y);
    }
    
    if (cross(c[1] - c[0], c[3] - c[2]) == 0) {
      printf("YES\n");
    } else {
      printf("NO\n");
    }
  }
  return 0;
}

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

int main()
{
	double x1, x2, x3, x4, y1, y2, y3, y4;
	int n, i;
	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);
		if ((x2 - x1)*(y4 - y3) - (x4 - x3)*(y2 - y1)==0.0)
		{
			printf("YES\n");
		}
		else
		{
			printf("NO\n");
		}
	}
	return 0;
}

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

int main(void){
  double xa,ya,xb,yb,xc,yc,xd,yd;
  int n;
  cin >> n;
  while( --n >=0){
    cin >> xa >> ya >> xb >> yb >> xc >> yc >> xd >> yd;

    if( (yb - ya)/(xb - xa) == (yd - yc)/(xd - xc))
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }
  return 0;
}

C++: #include <iostream>
#include <cmath>
#define rep(i,a,n) for(int i=a; i<n; i++)
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;
        
        double a1 = x2 - x1;
        double b1 = y2 - y1;
        double a2 = x4 - x3;
        double b2 = y4 - y3;
        
        if(abs(a1 * b2 - a2 * b1) < 1e-10) cout << "YES" << endl;
        else cout << "NO" << endl;
    }
    return 0;
}

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

int main(void){
    int n;
    cin >> n;
    for(int i=0,i<n,i++) {

    double x[4],y[4],a,b,c,d,p,q,det,ansx,ansy;
    //入力を多少簡略化
    for(int i=0;i<4;i++) {
        scanf("%lf" ,&x[i]);
        scanf("%lf" ,&y[i]);
    }
    //(x1,y1)(x2,y2)を結ぶax+by=p の係数
    a = y[0]-y[1];  b = x[1]-x[0];
    //(x3,y3)(x4,y4)を結ぶcx+dy=q の係数
    c = y[2]-y[3];  d = x[3]-x[2];
    //係数についての行列式
    det = a*d-c*b;
    if(det == 0) puts("YES");
    else puts("NO");
    /*
    //det=0で解は存在しない(この問題については２線分は同一直線上にないから)
    if(fabs(det) < 0.00001) puts("YES");
    //逆行列を用いて解を導出
    else {
        /*
        ansx = (d*p - b*q)/det;
        ansy = (-c*p + a*q)/det;
        //ansxがどちらの線分のx座標範囲にも含まれるかを判定
        if((x[0] - ansx)*(x[1] - ansx) <= 0.00001 && (x[2] - ansx)*(x[3] - ansx) <= 0.00001 ) {
            printf("YES (%lf, %lf)\n",ansx,ansy);
        } else puts("NO");
        
       puts("NO");
    }
    */
    }
}

C++: 
#include <iostream>
#include <complex>
#include <cmath>

using namespace std;

typedef complex<double> Point;

bool parallel(const Point &v1, const Point &v2) {
    return abs(v1.real()*v2.imag() - v1.imag()*v2.real()) < 1e-6;
}

int main() {
    int N;
    cin >> N;
    while(N--) {
        Point ps[4];
        for(int i = 0; i < 4; ++i) cin >> ps[i].real() >> ps[i].imag();
        Point v1 = ps[1]-ps[0], v2 = ps[3]-ps[2];

        if(parallel(v1, v2) && !parallel(v1, ps[2]-ps[1])) cout << "YES" << endl;
        else cout << "NO" << endl;
    }
    return 0;
}

C++: #include <iostream>
#include <complex>
#include <vector>
#include <cmath>

#define rep(i,n) for(int i=0;i<n;i++)
#define EPS 1e-15

using namespace std;

typedef complex<double> P;

int main()
{
	int n;
	cin >> n;
	while(n--)
	{
		vector<P> p;
		rep(i,4)
		{
			double a,b;
			cin >> a >> b;
			p.push_back(P(a,b));
		}

		P a = p[1] - p[0];
		P b = p[3] - p[2];
		double t = a.real()*b.imag() - a.imag()*b.real();
		if(abs(t) < EPS)
		{
			cout << "YES" << endl;
		}
		else
		{
			cout << "NO" << endl;
		}
	}
	return 0;
}

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

int main()
{
	int num ;
	float ax, ay, bx, by, cx, cy, dx, dy ;

	cin >> num ;
	for( int i = 0 ; i < num ; i ++ )
	{
		cin >> ax >> ay >> bx >> by >> cx >> cy >> dx >> dy ;

		if( (ay-by)/(ax-by) == (cy-dy)/(cx-dx) ) cout << "YES\n" ;
		else cout << "NO\n" ;
	}
	return 0;
}

C++: #define _CRT_SECURE_NO_WARNINGS
#include<cstdio>
#include<cmath>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<utility>
#include<iomanip>
#include<vector>
#include<string>
#include<queue>
#include<stack>
#include<map>
#include<list>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define repp(i,k,n) for(int i=k;i<(int)n;i++)
#define F first
#define S second
using namespace std;
const int dx[4] = { 0, 1, 0, -1 }, dy[4] = { 1, 0, -1, 0 };
const int dX[8] = { 0, 1, 1, 1, 0, -1, -1, -1 }, dY[8] = { 1, 1, 0, -1, -1, -1, 0, 1 };
struct XY
{
	int x;
	int y;
};
int in()
{
	int x;
	cin >> x;
	return x;
}

/*
(char)'1' - (int)48 = (int)1;
　1111181
*/
////////////////////////////////////////////////////
int main()
{
	int n;
	cin >> n;
	rep(EEE, n)
	{
		double x1, x2, x3, x4, y1, y2, y3, y4;
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		if (x1 == x2 || x3 == x4)
		{
			if (x1 == x2&&x3 == x4)cout << "YES<" < endl;
			else cout << "NO" << endl;
		}
		else if ((x1 - x2)*(y3-y4) == (x3 - x4)*(y1 - y2))cout << "YES" << endl;
		else cout << "NO" << endl;

	}

}

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

C++: #include <string>
#include <vector>
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<stack>
#include<queue>
#include<cmath>
#include<algorithm>
#include<functional>
#include<list>
#include<deque>
#include<bitset>
#include<set>
#include<map>
#include<cstring>
#include<sstream>
#include<complex>
#include<iomanip>
#include<numeric>
#define X first
#define Y second
#define pb push_back
#define rep(X,Y) for (int (X) = 0;(X) < (Y);++(X))
#define rrep(X,Y) for (int (X) = (Y-1);(X) >=0;--(X))
#define repe(X,Y) for ((X) = 0;(X) < (Y);++(X))
#define peat(X,Y) for (;(X) < (Y);++(X))
#define all(X) (X).begin(),(X).end()
#define rall(X) (X).rbegin(),(X).rend()

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
template<class T> ostream& operator<<(ostream &os, const vector<T> &t) {
os<<"{"; rep(i,t.size()) {os<<t[i]<<",";} os<<"}"<<endl; return os;}
template<class S, class T> ostream& operator<<(ostream &os, const pair<S,T> &t) { return os<<"("<<t.first<<","<<t.second<<")";}

int main(){
  ios_base::sync_with_stdio(false);
  cout<<fixed<<setprecision(0);
  int i,j,k,T;
  cin>>T;
  while(T--){
    double xx,yy;
    ll x[4],y[4];
    rep(i,4){
      cin>>xx>>yy;
      x[i]=xx*1e6;
      y[i]=yy*1e6;
      //   cout<<x[i]<<","<<y[i]<<endl;
    }
    rep(i,2){
      x[i*2+1]-=x[i*2];
      y[i*2+1]-=y[i*2];
    }
    cout<<(x[1]*y[3]==x[3]*y[1]?"YES":"NO")<<endl;
  }
  return 0;
}