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++: //????????????????????????
#include<iostream>
#include<cmath>
using namespace std;

double EPS = 1e-8;

//??\????????°???????????°?????????????????????
//????¬?????????????????????????
//??¢??°vAdd, vSet????????????????????????????????¢?????????????????¶public:
//???????????????????????°??????????????§????????¨?????¶
//??\???????????§??????????????????????????????????????????????????????
class C3DVec{
    private:    //private: ????????¨???????????¢??????????????§?????????
    
    public:     //public: ????????¨???????????¢???????????????
    double x, y;
    
    //??°????????????????????????+????????????????????????
    C3DVec operator+(C3DVec v2){
        C3DVec vRet;
        
        //???????????????v?????¨??????
        vRet.x = x + v2.x;
        vRet.y = y + v2.y;
    
        return vRet;
    }
    
    //????§???????????????????????????????
    C3DVec operator-(C3DVec v2){
        C3DVec vRet;
        
        //???????????????v1??¨??????
        vRet.x = x - v2.x;
        vRet.y = y - v2.y;
        
        return vRet;
    }
    
    //????§?????????????????????¨??????????????????????????????
    C3DVec operator*(float sc){
        C3DVec vRet;
        
        vRet.x = x * sc;
        vRet.y = y * sc;
        
        return vRet;
    }
    
    
    
    //()????????????????????????????????°????????????????????±??????
     void operator() (double ix, double iy){
        C3DVec vRet;
    
        x = ix;
        y = iy;
    }
};

//???????????¨?????\??????????????????????????????????????????????????????????????¢??°
C3DVec operator*(float sc, C3DVec vi){
    C3DVec vRet;
    
    //?????????????????????????????????????????°????????????????????§???
    //??¢??°??????????????????????????????????????????
    vRet.x = vi.x * sc;
    vRet.y = vi.y * sc;
    
    return vRet;
}

//????????????????????????????????????
    double dot(C3DVec v1, C3DVec v2){
        return (v1.x * v2.x) + (v1.y * v2.y);
    }


int main(void){
    C3DVec va, vb, vc, vd;
    double x1, x2, x3, x4, y1, y2, y3, y4;
    int n;
    
    cin >> n;
    for(int i = 0; i < n; i++){
        //??????????????????
        cin >> x1 >> y1 >> x2 >> y2;
        cin >> x3 >> y3 >> x4 >> y4;
        
        //?????????????????????
        va(x1, y1);
        vb(x2, y2);
        vc(x3, y3);
        vd(x4, y4);
        
        //????????????????????????
        C3DVec vAB = vb - va;
        C3DVec vCD = vd - vc;
         
        //???????????¶????????????????????????
        if(dot(vAB, vCD) > EPS) cout << "YES" << endl;
        else            cout << "NO"  << endl;; 
    }
    
    return 0;
}

C++: #include<stdio.h>
 
int main(void){
    double x[4],y[4];
    int n,i;
     
    scanf("%d",&n);
     
    for(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]);
         
        if(((y[1]-y[0])/(x[1]-x[0])) == ((y[3]-y[2])/(x[3]-x[2])))printf("YES\n");
        else printf("NO\n");
    }
     
    return 0;
}

C++: #include <iostream>

using namespace std;

int main() {
  int n;
  cin >> n;

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

  return 0;
}

C++: #include <stdio.h>

int
main(void)
{
	int n;

	scanf("%d", &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);

		(y2-y1)/(x2-x1) == (y4-y3)/(x4-x3)
		if ((y2 - y1)/(x2 - x1) == (y4 - y3)/(x4 - x3)) {
			printf("YES\n");
		} else {
			printf("NO\n");
		}
	}

	return 0;
}

C++: #include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<vector>
#include<cmath>
#include<cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb(in,tmp) in.push_back(tmp)
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
using namespace std;
int main(){
  int n;
  double ax,ay,bx,by,cx,cy,dx,dy;
  cin>>n;
  rep(i,n){
    cin>>ax>>ay>>bx>>by>>cx>>cy>>dx>>dy;

    if((ax-bx)*(cy-dy)==(cx-dx)*(ay-by))cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
  }
  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 c = (y2 - y2) / (x1 - x2);
    double b = (y4 - y3) / (x4 - x3);
    double d = (y3 - y4) / (x3 - x4);
    if(a == b || a == d || c == b || c == d){
      cout << "YES" << endl;
    }
    else{
      cout << "NO" << endl;
    }
  }

  return 0;
}

C++: #include<iostream>
#include<cmath>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
using namespace std;

int main(){
	double x[4],y[4],n;
	cin>>n;
	rep(i,n){
		rep(i,4)cin>>x[i]>>y[i];
		double vx=x[1]-x[0],vy=y[1]-y[0],ux=x[3]-x[2],uy=y[3]-y[2];
		double la=sqrt(vx*vx+vy*vy),lb=sqrt(ux*ux+uy*uy);
		if(abs(abs(vx*ux+vy*uy)-la*lb)<1e-6)cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
	}
	return 0;
}

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

C++: #include <bits/stdc++.h>
using namespace std;
int main(){
  int n;
  double x1,x2,x3,x4,y1,y2,y3,y4;
  cin >> n;
  string ans[n];
  for(int i=0;i<n;i++){
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
    if((y1-y2)/(x1-x2)==(y3-y4)/(x3-x4) and (y1-y3)/(x1-x3)!=(y1-y2)/(x1-x2) and (y1-y4)/(x1-x4)!=(y1-y2)/(x1-x2) and x1-x2!=0 and x3-x4!=0 and y1-y2!=0 and y3-y4!=0){
      ans[i]="YES";
    }else{
      ans[i]="NO";
    }
  }
  for(int i=0;i<n;i++){
    cout << ans[i] << endl;
  }
  return 0;
}

C++: #include <iostream>

using namespace std;

typedef struct myvector{
  double x;
  double y;
}Vector;

Vector sub_vector(Vector& a, Vector& b)
{
  Vector ret;
  ret.x = b.x - a.x;
  ret.y = b.y - a.y;
  return ret;
}

double cross_product(Vector& a, Vector& b)
{
  return a.x * b.y - b.x * a.y;
}

int main()
{
  int n;
  cin >> n;
  for(int i = 0; i < n; i++){
    Vector A, B, C, D;
    cin >> A.x >> A.y >> B.x >> B.y >> C.x >> C.y >> D.x >> D.y;
    Vector AB = sub_vector(A, B);
    Vector CD = sub_vector(C, D);
    if((cross_product(AB, CD) * 10000.0 == 0)
      cout << "YES" << endl;
    else 
      cout << "NO" << endl;
  }
}

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