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 <complex>
#include <iostream>


#define EPSILON 1e-9


class vector_t {
public:
  double x;
  double y;
  double z;

public:
  vector_t(double x = 0, double y = 0, double z = 0) : x(x), y(y), z(z) {};

public:
  vector_t operator^(const vector_t& v) const {
    return vector_t(y * v.z - z * v.y,
                    z * v.x - x * v.z,
                    x * v.y - y * v.x);
  };
};


class point_t {
public:
  double x;
  double y;
  double z;
  double w;

public:
  point_t(double x = 0, double y = 0, double z = 0, double w = 1) : x(x), y(y), z(z), w(w) {};
  
public:
  vector_t operator-(const point_t& p) const {
    return vector_t(x - p.x, y - p.y, z - p.z);
  };
};


int main(int argc, char** argv)
{
  int n;

  std::cin >> n;

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

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

    vector_t AB(point_t(x2, y2) - point_t(x1, y1));
    vector_t CD(point_t(x4, y4) - point_t(x3, y3));

    if (std::abs((AB ^ CD).z) < EPSILON) {
      std::cout << "YES" << std::endl;
    }
    else {
      std::cout << "NO" << std::endl;
    }
  }
}

C++: #include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,x,n) for(int i=(x);i<(n);i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define mp make_pair
#define fir first
#define sec second
#define ub upper_bound
#define lb lower_bound
#define int long long
using namespace std;
const int MOD=1000000007;
const int INF=1000000009;


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

C++: #include<vector>
#include<iostream>
#include<cstdio>
using namespace std;
double x1,y1,x2,y2,x3,y3,x4,y4;
int n;
int main()
{
  scanf("%d\n",&n);
  for(int i = 0;i < n;i++){
    scanf("%lf %lf %lf %lf %lf %lf %lf %lf", &x1, &y1, &x2, &y2, &x3, &y3, &x4,
	  &y4);
    if((y1-y2)/(x1-x2)==(y3-y4)/(x3-x4)){
	cout <<"YES"<<endl;
    }
    else
      cout<<"NO"<<endl;
  }
  return 0;
}

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

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

C++: #include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <climits>
using namespace std;

int main(){
    double e = 1e-12;
    double x[4];
    double y[4];
    double s;
    double t;
    double u;
    double v;
    double m;
    int n;
    cin >> n;

    for (int t = 0;t < n;++t) {
        for (int i = 0;i < 4;++i){
            cin >> x[i] >> y[i]; 
        }
    }
    s = x[1] - x[0];
    t = y[1] - y[0];
    u = x[3] - x[2];
    v = y[3] - y[2];

    if(s * v - t * u > 0){
        double m = s * v - t * u;
    }
    else{
        double m = t * u - s * v;
    }

    if(m > e){
        cout << "YES" << endl;
    }
    else{
        cout << "NO" << endl;
    }
    return 0;
}

C++: #include <stdio.h>

int main()
{
	int n;
	double x1, x2, x3, x4, y1, y2, y3, y4;

	scanf("%d", &n);

	for (int i = 0; i < n; i++){
		scanf("%lf %lf %lf %lf %lf %lf %lf %lf", &x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4);
		x2 = x2-x1;
		x4 = x4-x3;
		y2 = y2-y1;
		y4 = y4-y3;

		if((y2 != 0 && y4 != 0 && x2/y2 == x4/y4) || (y2 == 0 && y4 == 0)) printf("YES\n");
		else printf("NO\n");
	}

	return 0;
}

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

C++: #include<iostream>
#include<algorithm>
#include<string>
using namespace std;
int main() {
	int n;
	cin >> n;
	for (int z = 0; z < n; z++) {
		long float x1, x2, x3,y1, y2, y3, y4, x4 ;
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		if (y1 > y2) {
			swap(y1, y2);
			swap(x1, x2);
		}
		if (y3 > y4) {
			swap(y3, y4);
			swap(x3, x4);
		}
		if ((x1 > x2&&x3 > x4 && ((y2 - y1) / (x1 - x2) == (y4 - y3) / (x3 - x4))) || (x2 > x1&&x4 > x3 && ((y1 - y2) / (x2 - x1) == (y3 - y4) / (x4 - x3)))) {
			cout << "YES" << endl;
		}
		else {
			cout << "NO" << endl;
		}
	}
}

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

C++: #include<iostream>

using namespace std;

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

	double x1, y1, x2, y2, x3, y3, x4, y4;

	while (n--){
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		cout << ((((y2 - y1) / (x2 - x1)) == ((y4 - y3) / (x4 - x3))) ? "YES\n" : "NO\n");
	}

	return 0;
}

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

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

  for(int i=0;i<n;i++){
    complex<double> v[4];
    for(int j=0;j<4;j++){
      double x,y;
      cin >> x >> y;
      v[j]=complex<double>(x,y);
    }

    if((conj(v[1]-v[0])*(v[3]-v[2])).imag()==0)
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }

  return 0;
}

C++: #include <iostream>
#include <cmath>
using namespace std;
int main(){
  

  int dataSets;
  cin >> dataSets;
  for(int i=0;i<dataSets;i++){
    double x1, y1, x2, y2, x3, y3, x4, y4;
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
    if(abs((y2-y1)*(x4-x3) - (x2-x1)*(y4-y3)) < 0.0001){
      cout << "YES" << endl;
    }else{
      cout << "NO" << endl;
    }
    
  }

  return 0;

}

C++: #include<bits/stdc++.h>
using namespace std;

#define EPS (1e-10)

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 a,b;
        a=(y2-y1)/(x2-x1);
        b=(y4-y3)/(x4-x3);
        (fabs(a-b)<=EPS)? cout<<"YES"<<endl : cout<<"NO"<<endl;
    }
    return 0;
}