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 <iostream>
#include <complex>
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;
    complex<double> c1(x2 - x1, y2 - y1);
    complex<double> c2(x4 - x3, y4 - y3);
    cout << ((arg(c1) == arg(c2)) ? "YES" : "NO") << endl;
  }
}

C++: #include <stdio.h>

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

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

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

    double x1 = 0.0;
    double y1 = 0.0;
    double x2 = 0.0;
    double y2 = 0.0;
    double x3 = 0.0;
    double y3 = 0.0;
    double x4 = 0.0;
    double y4 = 0.0;

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

    double a = (y2 - y1) / (x2 - x1);
    double b = (y4 - y3) / (x4 - x3);
 double c = (y3 - y4) / (x3 - x4);
    if(a == b || a == c){
      cout << "YES" << endl;
    }
    else{
      cout << "NO" << endl;
    }
  }

  return 0;
}

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

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

	return 0;
}

C++: #include <iostream>
using namespace std;
int main(){
  
  double x1, y1, x2, y2, x3, y3, x4, y4;
  int dataSets;
  cin >> dataSets;
  for(int i=0;i<dataSets;i++){
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
    if((y2-y1)*(x4-x3) - (x2-x1)*(y4-y3)==0){
      cout << "YES" << endl;
    }else{
      cout << "NO" << endl;
    }
    
  }

  return 0;

}

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

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

int main(){
  double a,b,c,d,e,f,g,h,m[4];
  int s;
  cin>>s;
  for(int j=0;j<s;j++){
    cin>>a>>b>>c>>d>>e>>f>>g>>h;
    m[0]=c-a;
    m[1]=g-e;
    m[2]=d-b;
    m[3]=h-f;
    if(m[2]*m[0]==m[3]*m[1])cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
  }
  return 0;
}

C++: #include<iostream>
#include<iomanip>
#include<algorithm>
#include<cctype>
#include<cmath>
#include<cstdio>
#include<set>
#include<stack>
#include<string>
#include<sstream>
#include<map>
#include<queue>
#include<vector>
using namespace std;

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

C++: //C++14 (Clang 3.8.0)

#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <string>
#include <climits>
using namespace std;
typedef long long ll;
typedef pair<long long,long long> P;
double eps=1e-10;
int main(){
  int d;
  cin>>d;
  for(int dd=0;dd<d;dd++){
  double x1,x2,x3,x4,y1,y2,y3,y4;
  cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
  double c=(x2-x1)*(y3-y4)-(y2-y1)*(x3-x4);
  if(abs(c)<eps)cout<<"YES"<<endl;
  else cout<<"NO"<<endl;
  }
}

C++: #include<bits/stdc++.h>
#define P pair<int,int>
using namespace std;
 
int main(){
    int a;
    cin>>a;
    double b[12];
    for(int c=0;c<a;c++){
	for(int d=0;d<8;d++)scanf("%lf",&b[d]);
	b[8]=b[2]-b[0];
	b[9]=b[3]-b[1];
	b[10]=b[6]-b[4];
	b[11]=b[7]-b[5];
	if(b[8]/b[9]==b[10]/b[11])puts("YES");
	else puts("NO");
	}
    }

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) {
	LD A = (y[1] - y[0]) * (x[1] - x[0]);
	LD B = (y[3] - y[2]) * (x[3] - x[2]);

	if (A == B) return true;
	else return false;	
}


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

	int num;
	cin >> num;

	REP(i, num) {
		vector<LD>x(4);
		vector<LD>y(4);

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

C++: //C++14 (Clang 3.8.0)

#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <string>
#include <climits>
using namespace std;
typedef long long ll;
typedef pair<long long,long long> P;
double eps=1e-9;
int main(){
  int d;
  cin>>d;
  for(int dd=0;dd<d;dd++){
  double x1,x2,x3,x4,y1,y2,y3,y4;
  cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
  double c=(x2-x1)*(y3-y4)-(y2-y1)*(x3-x4);
  if(abs(c)<eps)cout<<"YES"<<endl;
  else cout<<"NO"<<endl;
  }
}