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++: /*

Parallelism(https://onlinejudge.u-aizu.ac.jp/problems/0021)
前

*/
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <cmath>
#include <complex>
#include <map>
#include <set>
#include <vector>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cassert>
#include <iomanip>
using namespace std;

#define Rep(b, e, i) for(int i = b; i <= e; i++)
#define Repr(e, b, i) for(int i = e; i >= b; i--)
#define rep(n, i) Rep(0, n-1, i)
#define repr(n, i) Repr(n-1, 0, i)
#define all(v) (v).begin(), (v).end()
#define pb(v) push_back(v)
#define uniq(v) (v).erase(unique(all(v)),(v).end())
#define bitcnt(x) __builtin_popcount(x)
#define fst first
#define snd second
#define Pqaz(T) priority_queue<T,vector<T>,greater<T>>
#define Pqza(T) priority_queue<T>
#define put(x) cout << x;
#define putsp(x) cout << x << ' ';
#define putln(x) cout << x << endl;
#define ENJYU std::ios::sync_with_stdio(false);std::cin.tie(0);

typedef long long ll;
typedef pair<ll, ll> llP;
typedef pair<int, int> intP;
typedef complex<double> comp;
typedef vector <int> vec;
typedef vector <ll> vecll;
typedef vector <double> vecd;
typedef vector <vec> mat;
typedef vector <vecll> matll;
typedef vector <vecd> matd;

//vector の中身を出力
template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}

const int MAX = 200000;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<29;
const ll INFL = 1e18;
const int MOD = 1000000007;

int dx4[4]={1,0,-1,0};
int dy4[4]={0,1,0,-1};
int dx8[8]={1,0,-1,1,-1,1,0,-1};
int dy8[8]={1,1,1,0,0,-1,-1,-1};

//********************************template END****************************************//

//外積を計算する関数
double gaiseki(comp a, comp b)
{
	return (conj(a)*b).imag();
}

void solve(void){

	int N;
	cin >> N;
	while(N--)
	{

		double xs[4], ys[4];
		rep(4, i)
		{
			cin >> xs[i] >> ys[i];
		}

		vector <comp> ps(4);
		rep(4, i)
		{
			ps[i] = comp(xs[i], ys[i]);
		}

		//直線AB,CDに対応するベクトルl,m　回転用のr
		comp l = ps[1]-ps[0], m = ps[3]-ps[2], r = polar(1., PI/180);

		l *= r, m *= r;

		cout << (abs(gaiseki(l, m)) < EPS ? "YES" : "NO") << endl;

	}

}

int main(void){
	solve();
	//cout << "yui(*-v・)yui" << endl;
	return 0;
}

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

using namespace std;

double ESP = 1e-10;

struct point {
  double x, y;
};

int main() {
  int n;
  point P[4];

  cin >> n;
  while(n){
    for(int i = 0; i < 4; i++){
      cin >> P[i].x >> P[i].y;
    }

    if(abs((P[1].y - P[0].y)*(P[3].y - P[2].y) - (P[3].x - P[2].x)*(P[1].x - P[0].x)) < ESP) {
      cout << "YES" << endl;
    } else {
      cout << "NO" << endl;
    }
    n--;
  }

    return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
  int n;
  cin >>n;
  while(n--){
    double a[2],b[2],c[2],d[2];
    cin >>a[0]>>a[1]>>b[0]>>b[1]>>c[0]>>c[1]>>d[0]>>d[1];
    if((b[0]-a[0])*(d[1]-c[1])-(b[1]-a[1])*(d[0]-c[0]) == 0) cout <<"YES"<<endl;
    else cout <<"NO"<<endl;
  }
  return 0;
}

C++: #include "bits/stdc++.h"

#define REP(i, n) for(decltype(n) i = 0; i < (n); i++)
#define REP2(i, x, n) for(decltype(x) i = (x); i < (n); i++)
#define RREP(i, n) for (decltype(n) i = (n) - 1;i >= 0; i--)

#define ALL(a) (a).begin(),(a).end()
#define SORT(c) sort((c).begin(),(c).end())
#define DESCSORT(c) sort(c.begin(), c.end(), greater<int>())

#define LL long long int
#define LD long double

#define PI 3.14159265358979

#define _CRT_SECURE_NO_WARNINGS

using namespace std;

//================================================
bool func(vector<LD>x, vector<LD>y) {
	if ((y[1] - y[0]) * (x[3] - x[2]) == (y[3] - y[2]) * (x[1] - x[0])) return true;
	else return false;	
}


int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);

	int num;
	cin >> num;

	vector<LD>x(4); vector<LD>y(4);
	while(num--) {
		REP(i, 4) cin >> x[i] >> y[i];
		cout << (func(x, y) ? "YES" : "NO") << "\n";
	}
	return 0;
}

C++: #include <cstdio>

int main(){
	int n;
	double a1, a2, x[4], y[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]);
		a1 = (y[0] - y[1]) / (x[0] - x[1]);
		a2 = (y[2] - y[3]) / (x[2] - x[3]);
		if(a1 == a2) printf("YES\n");
		else printf("NO\n");
	}
	return 0;
}

C++: #include <stdio.h>
int main() {int N;double x1,x2,x3,x4,y1,y2,y3,y4;scanf("%d",&N);while (N--) {scanf("%lf %lf %lf %lf %lf %lf %lf %lf",&x1,&y1,&x2,&y2,&x3,&y3,&x4,&y4);if (((x2-x1)==(x3-x4) && (y1-y2)==(y4-y3)) || ((y1-y2)==(y3-y4) && (x2-x1)==(x4-x3))) puts("YES"); else puts("NO");}return 0;}

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

C++: #include <iostream>
#include <cmath>
     
int main() {
    int n;
    std::cin >> n;
    while(n--){
		double x1, y1, x2, y2, x3, y3, x4, y4;
		std::cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		int ix1 = round(x1*100000), iy1 = round(y1*100000),
			ix2 = round(x2*100000), iy2 = round(y2*100000),
			ix3 = round(x3*100000), iy3 = round(y3*100000),
			ix4 = round(x4*100000), iy4 = round(y4*100000);
		int a = iy1 - iy2, b = ix2 - ix1, c = iy3 - iy4, d = ix4 - ix3;
		if(!((long long int)a*d - (long long int)b*c))
			std::cout << "YES" << std::endl;
		else
			std::cout << "NO" << std::endl;
		}
    return 0;
}

C++: #include <stdio.h>

int main(void)
{
  int n,i;
  long double x1,y1,x2,y2,x3,y3,x4,y4;
  int ans[100];
  
  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( (y2-y1)*(x4-x3) == (y4-y3)*(x2-x1) ){
      ans[i] = 1;
    }else{
      ans[i] = 0;
    }
  }

  for(i = 0;i < n;i++){
    if(ans[i] == 1){
      printf("YES\n");
    }else{
      printf("NO\n");
    }
  }
  return 0;
}

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

int main() {
	int N;
	cin>>N;
	for(;N--;){
		double x1,y1,x2,y2,x3,y3,x4,y4;
		cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
		if(((y2-y1)/(x2-x1))==((y4-y3)/(x4-x3))) 
		cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
	}
}