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 <vector>
#include <cmath>
#include <iostream>
using namespace std;

int main(){
    int n;
    for (int i = 0; i < n; i++){
	double x[5];
	double y[5];
	
	for (int i = 1; i <= 4; i++) cin >> x[i] >> y[i];
	
	if (x[1] > x[2]){
	    swap(x[1], x[2]);
	    swap(y[1], y[2]);
	}
	if (x[3] > x[4]){
	    swap(x[3], x[4]);
	    swap(y[3], y[4]);
	}
	if ((x[2] - x[1]) / (y[2] - y[1]) == (x[4] - x[3]) / (y[4] - y[3]))
	    cout << "YES" << endl;
	else cout << "NO" << endl;
    }
}

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

using namespace std;

int main() {
	int k;
	double x1,x2,x3,x4,y1,y2,y3,y4;
	double katamuki1;
	double katamuki2;
	cin >> k;

	for (int i = 0; i < k; i++) {
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;

		katamuki1 = (y2 - y1) / (x2 - x1);
		katamuki2 = (y4 - y3) / (x4 - x3);

		if (katamuki1 == katamuki2) {
			/*if(((y4 - y1) / (x4 - x1)) == ((y3 - y2) / (x3 - x2)) && ((y3 - y1) / (x3 - x1)) == ((y4 - y2) / (x4 - x2))) {
				cout << "NO" << endl;
			} else {*/
				cout << "YES" << endl;
			//}
		} else {
			cout << "NO" << endl;
		}
	}
	return 0;
}

C++: 
#include <iostream>
#include <stdio.h>
#include <fstream>
#include <algorithm>
#include <string>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <limits.h>
#include <math.h>
#define rep(i,n) for (int i = 0; (i) < (n); ++ (i))
using namespace std;

int main(void){
    int n;
    double x[4],y[4],a,b,c,d,det;
    cin >> n;
    rep(j,n) {

    
    //入力を多少簡略化
    for(int i=0;i<4;i++) {
        cin >> x[i];
        cin >> 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(fabs(det) < 0.00001) cout << "YES" << endl;
    else cout << "NO" << endl;
    }
}
#define rep(i,n) for (int i = 0; (i) < (n); ++ (i))
using namespace std;

int main(void){
    int n;
    double x[4],y[4],a,b,c,d,det;
    cin >> n;
    rep(j,n) {

    
    //入力を多少簡略化
    for(int i=0;i<4;i++) {
        cin >> x[i];
        cin >> 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(absf(det) < 0.00001) cout << "YES" << endl;
    else cout << "NO" << endl;
    }
}

C++:  
 #include<iostream>
 #include<stdio.h>
 #include<string>
 #include<math.h>
 #include<iomanip>
 #include<algorithm>
 #include<string.h>
 #include<cctype>
 #include<map>
 #include<set>
 #include<vector>
 #include<sstream>
 #include<stack>
 
 using namespace std;
 
 double abs(double x)
 {
   if(x<0) return -x;
   else return x;       
 }
  
 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(x2==x1&&x3==x4) cout<<"YES"<<endl;
     else 
     {
       double k1=(y2-y1)/(x2-x1);
       double k2=(y4-y3)/(x4-x3);
       if(abs(k1-k2)<0.000001) cout<<"YES"<<endl;
       else cout<<"NO"<<endl;     
     }          
   }
   //while(1);      
   return 0;    
 }

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

int main(){
    int n;
    double x1,y1,x2,y2,x3,y3,x4,y4,ll,lll;
    cin >> n;
    for(int i=0;i<n;i++){
        cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
        ll = (y2-y1)/(x2-x1);
        lll = (y4-y3)/(x4-x3);
        cout << ((ll == lll)? "YES" : "NO") << endl;
    }
}

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

C++: #include<iostream>
using namespace std;
int main(){
    int n;
    double x1,x2,x3,x4,y1,y2,y3,y4;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;

        double line1,line2;
        line1=(y2-y1)/(x2-x1);
        line2=(y4-y3)/(x4-x3);
        (line1==line2)? cout<<"YES"<<endl : cout<<"NO"<<endl;
    }
    return 0;
}

C++: #include<bits/stdc++.h>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
using namespace std;

struct vec{
	double x;
	double y;
};

int main(){
	int n;
	cin>>n;
	double x[4],y[4];//0:A 1:B 2:C 3:D
	rep(i,n){
		rep(j,4)cin>>x[j]>>y[j];
		vec ABvec;
		vec CDvec;
		ABvec.x=x[1]-x[0];
		ABvec.y=y[1]-y[0];
		CDvec.x=x[3]-x[2];
		CDvec.y=y[3]-y[2];
		double elmeet=abs(ABvec.x*CDvec.x+ABvec.y*CDvec.y);
		double ABnolme=sqrt(pow(ABvec.x,2)+pow(ABvec.y,2));
		double CDnolme=sqrt(pow(CDvec.x,2)+pow(CDvec.y,2));
		if(abs(ABnolme*CDnolme-elmeet)<10e-7)cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
	}
	return 0;
}

C++: #include<iostream>
#include <string>
#include<stdio.h>

using namespace std;

int _tmain(int argc, _TCHAR* argv[])
{
	double x1[100], y1[100], x2[100], y2[100], x3[100], y3[100], x4[100], y4[100];
	double tendAB, tendCD;
	int num;
	int pos = 0;

	cin >> num;
	while (num--) {
		cin >> x1[pos] >> y1[pos] >> x2[pos] >> y2[pos] >> x3[pos] >> y3[pos] >> x4[pos] >> y4[pos];
		pos++;
	}
	for (int i = 0; i < pos; i++) {
		tendAB = (y1[i] == y2[1]) ? 0 : (x2[i] - x1[i]) / (y2[i] - y1[i]);
		tendCD = (y3[i] == y4[1]) ? 0 : (x4[i] - x3[i]) / (y4[i] - y3[i]);
		if (tendAB == tendCD) cout << "YES" << endl; else cout << "NO" << endl;
	}

	return 0;
}

C++: #include <iostream>

using namespace std;

int main()
{
	double xa, ya, xb, yb, xc, yc, xd, yd;
	double AB, CD;
	int num = 0, i = 0;

	cin >> num;
	while ( i < num )
	{
		cin >> xa >> ya >> xb >> yb >> xc >> yc >> xd >> yd;
		AB = ( ya - yb ) / ( xa - xb );
		CD = ( yc - yd ) / ( xc - xd );
		if ( AB == CD )
		{
			cout << "YES" << endl;
		}
		else if ( AB != CD )
		{
			cout << "NO" << endl;
		}

		i = i + 1;
	}

	return 0;
}

C++: #include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef complex<double> P;
typedef pair<int,int> pii;
#define REP(i,n) for(ll i=0;i<n;++i)
#define REPR(i,n) for(ll i=1;i<n;++i)
#define FOR(i,a,b) for(ll i=a;i<b;++i)
 
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()
 
#define MOD (ll)(1e9+7)
#define ADD(a,b) a=((a)+(b))%MOD
#define FIX(a) ((a)%MOD+MOD)%MOD
 
int main(){
int n;
cin>>n;
double x1,y1,x2,y2,x3,y3,x4,y4;
while(n--){
scanf("%lf%lf%lf%lf%lf%lf%lf%lf",&x1,&y1,&x2,&y2,&x3,&y3,&x4,&y4);
P a(x2-x1,y2-y1);
P b(x4-x3,y4-y3);
double cr = imag(conj(a)*b);
if(abs(cr)<1e-9){
  cout<<"YES"<<endl;
}else{
  cout<<"NO"<<endl;
}
}
  return 0;
}