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

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>
using namespace std;

int main(void)
{
    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 (((x2-x1)==0) && ((x4-x3)==0))
            cout << "YES" << endl;
        else {
            double d = abs((y2-y1)*(x4-x3) - (y4-y3)*(x2-x1));
            cout << ((d <= 1e-10)? "YES" : "NO") << endl;
        }
    }
    return 0;
}

C++: #include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<cmath>
#define ll long long int
using namespace std;
typedef pair<int, int> P;

string str;

int main()
{
  double x1,x2,x3,x4,y1,y2,y3,y4;
  double dx1,dy1,dx2,dy2;
  int n;
  int i;

  cin>>n;
  for(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==0 && dx2==0)
      cout<<"YES"<<endl;
    else if(dx1==0 || dx2==0)
      cout<<"NO"<<endl;
    else if(dy1/dx1 == dy2/dx2)
      cout<<"YES"<<endl;
    else
      cout<<"NO"<<endl;
  }
}

C++: #include<iostream>
#include<cstdio>
#include<algorithm>
#include<climits>
#include<queue>
#include<map>
#include<set>
#include<vector>
#include<list>
#include<stack>
#include<cstring>
#include<string>
#include<cmath>
using namespace std;
#define EPS 0.0000000000001

struct Line{
	double x[2],y[2];
};

int main(){
	int N;
	Line l[2];
	cin>>N;
	for(int tc=0;tc<N;tc++){
		for(int i=0;i<2;i++){
			for(int j=0;j<2;j++){
				cin>>l[i].x[j]>>l[i].y[j];
			}
		}
		double a,b;
		a = (l[0].y[1]-l[0].y[0])/(l[0].x[1]-l[0].x[0]);
		b = (l[1].y[1]-l[1].y[0])/(l[1].x[1]-l[1].x[0]);
		if(abs(a-b)<EPS) puts("YES");
		else puts("NO");
	}
}

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

using namespace std;

void swap(double &x, double &y, double &xx, double &yy) 
{
  double tmp_x = x;
  double tmp_y = y;
  x = xx;
  y = yy;
  xx = tmp_x;
  yy = tmp_y;
}

bool isZero(double x) 
{
  return x < 0.000001;
}

void compute(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4) 
{
  if (x1 > x2) swap(x1, y1, x2, y2);
  if (x3 > x4) swap(x3, y3, x4, y4);

  double diff_x12 = x2 - x1;
  double diff_y12 = y2 - y1;
  double diff_x34 = x4 - x3;
  double diff_y34 = y4 - y3;

  // if (isZero(diff_x12) && isZero(diff_y12))
  //   cout << "NO" << endl;
  // else if (isZero(diff_x34) && isZero(diff_y34))
  //   cout << "NO" << endl;  
  if (!isZero(diff_x12) && !isZero(diff_x34)) {
    if (isZero(diff_y12) && isZero(diff_y34))
      cout << "YES" << endl;
    else {
      double ab = diff_y12 / diff_x12;
      double cd = diff_y34 / diff_x34;
      if (isZero(abs(ab - cd)))
        cout << "YES" << endl;
      else
        cout << "NO" << endl;
    }
  }
  else if (isZero(diff_x12) && isZero(diff_x34)) 
    cout << "YES" << endl;  
  else
    cout << "NO" << endl;  
}

int main(void) 
{
  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;
    compute(x1, y1, x2, y2, x3, y3, x4, y4);
  }
  
  return 0;
}

C++: #include <iostream>
using namespace std;
#define INF 10000000
int main( void )
{
	while ( !cin.eof() )
	{
		int n;
		cin >> n;

		if ( cin.eof() )
			break;

		for ( int i = 0; i < n; i++ )
		{
			double x1, x2, x3, x4;
			double y1, y2, y3, y4;

			cin >> x1 >> y1;
			cin >> x2 >> y2;
			cin >> x3 >> y3;
			cin >> x4 >> y4;

			double m1;
			double m2;
			if ( x2-x1 != 0 )
				m1 = (y2-y1)/(x2-x1);
			else
				m1 = INF;

			if ( x4-x3 != 0 )
				m2 = (y4-y3)/(x4-x3);
			else
				m2 = INF;

			if ( m1 == m2 )
				cout << "YES" << endl;
			else
				cout << "NO" << endl;
		}

	}

	return 0;
}

C++: #include<iostream>
using namespace std;
int main()
{
	int n;cin>>n;
	for(;n--;)
	{
		double a,b,c,d,e,f,g,h;cin>>a>>b>>c>>d>>e>>f>>g>>h;
		if(a==c||e==g)cout<<(a==c&&e==g?"YES":"NO")<<endl;
		cout<<((d-b)/(c-a)==(h-f)/(g-e)?"YES":"NO")<<endl;
	}
}

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

int n;

int main(){
	scanf("%d", &n);
	for(int i = 0; i < n; ++i){
		double x[4][2];
		for(int j = 0; j < 4; ++j){
			scanf("%lf%lf", x[j], x[j] + 1);
		}
		double y[2][2] = {
			{x[0][0] - x[1][0], x[0][1] - x[1][1]},
			{x[2][0] - x[3][0], x[2][1] - x[3][1]}
		};

		//printf("%lf\n", y[0][0] * y[1][1] - y[0][1] * y[1][0]);

		if(std::abs(y[0][0] * y[1][1] - y[0][1] * y[1][0]) < 0.001){
			printf("YES\n");
		}
		else{
			printf("NO\n");
		}
	}
	return 0;
}

C++: #include <iostream>

using namespace std;

int main(){
  int a,b,c,d,e,f,g,h;
  int n;
  cin>>n;
  while(n--){
    cin>>a>>b>>c>>d>>e>>f>>g>>h;
    if((c-a)/(d-b)==(g-e)/(h-f))cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
}
  return 0;
}