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)
		}
		if fpoints[0] == fpoints[2] && fpoints[4] == fpoints[6] {
			fmt.Println("YES")
		} else {
			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 <stdio.h>

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

C++: #include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <stdio.h>
#include <algorithm>
#include <string.h>
#include <string>
#include <cmath>
#include <complex>
#include <map>
using namespace std;

#define rep(i,n) for(int i=0;i<int(n);++i)
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define EPS 1e-11
#define F first
#define S second

static const double PI=6*asin(0.5);
typedef long long ll;
typedef complex<double> CP;
typedef pair<double,double> P;
static const int INF=1<<24;

int main(){
	double x[5],y[5];
	int n;
	cin>>n;
	rep(i,n){
		rep(j,4){
			cin>>x[j];
			cin>>y[j];
			//cout<<j<<" = "<<x[j]<<" "<<y[j]<<endl;
		}
		//P a=P( x[0]-x[1] ,y[0]-y[1]), b=P( x[2]-x[3] ,y[2]-y[3]);
		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 <stdio.h>
#include <math.h>


int main(){
	double x1,x2,x3,x4,y1,y2,y3,y4,value1,value2;
	int n;
	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);
		value1 = (y2-y1)/(x2-x1);
		value2 = (y4-y3)/(x4-x3);

		if(value1 == value2){
			printf("YES\n");
		}else{
			printf("NO\n");
		}

	}
    return 0;
}

C++: #include <vector>
#include <iostream>
#include <complex>

#define fs first
#define sc second

using namespace std;

typedef double D;
typedef complex<D> P;
typedef pair<P, P> L;
const D EPS=1e-12;


namespace std{
  bool operator<(const P &a, const P &b){
    return real(a)==real(b)?imag(a)<imag(b):real(a)<real(b);
  }
}

D cross(P x, P y){return imag(conj(x)*y);}

bool para(L a, L b){return abs(cross(a.fs - a.sc, b.fs-b.sc))<EPS;}

int main(){
  int n;
  cin >> n;
  for(int i=0;i<n;i++){
    D x1, y1, x2, y2, x3, y3, x4, y4;
    cin >>  x1 >> y1 >> x2 >> y2 >>  x3>> y3>> x4>> y4;
    P A = P(x1, y1);
    P B = P(x2, y2);
    P C = P(x3, y3);
    P D = P(x4, y4);
    L AB = L(A, B);
    L CD = L(C, D);
    if(para(AB, CD)){
      cout << "YES" << endl;
    }else{
      cout << "NO" << endl;
    }
  }
}

C++: #include <iostream>
#define REP(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
 
int main(){
	int n;
	cin >> n;
	double x1,y1,x2,y2,x3,y3,x4,y4;
	REP(i,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++: #include <bits/stdc++.h>
using namespace std;

int main() {
    int n;
    double x1, y1, x2, y2, x3, y3, x4, y4;
    cin >> n;
    while(n--) {
        cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
        cout << ((x2-x1)*(y4-y3) == (x4-x3)*(y2-y1) ? "YES" : "NO") << endl;
    }
    return 0;
}

C++: #include<iostream>
#include<vector>
#include<queue>
#include<stack>
#include<map>
#include<string>
#include<algorithm>
#include<utility>
#include<math.h>
#include<iomanip>
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
const int INF = pow(10, 8);
int main(){
  int n;cin>>n;
  while(n--){
    double ax, ay, bx, by, cx, cy, dx, dy;
    cin>>ax>>ay>>bx>>by>>cx>>cy>>dx>>dy;
    bx-=ax;by-=ay;dx-=cx;dy-=cy;
    if(abs(bx*dy-dx*by)<1e-10)cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
  }
  return 0;
}

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

int main()
{
	double x1, x2, x3, x4, y1, y2, y3, y4;
	int n, i;
	scanf("%d", &n);
	for (i = 0; i < n; i++)
	{
		scanf("%lf %lf %lf %lf %lf %lf %lf %lf", &x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4);
		if ((x2 - x1)*(y4 - y3) - (x4 - x3)*(y2 - y1))
		{
			printf("NO\n");
		}
		else
		{
			printf("YES\n");
		}
	}
	return 0;
}

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

C++: #include <iostream>
#include <cstdio>
#include <complex>

using namespace std;
typedef long long ll;

typedef double R;
typedef complex<R> P;

const R EPS = 1e-8;
const R PI = acos(-1);
int sgn(R a) {
    if (a < -EPS) return -1;
    if (a > EPS) return 1;
    return 0;
}


bool near(P a, P b) {
    return !sgn(abs(a-b));
}

double cross(const P &a, const P &b) { return imag(conj(a)*b); }
double dot(const P &a, const P &b) { return real(conj(a)*b); }

void solve() {
    P p[4];
    for (int i = 0; i < 4; i++) {
        R x, y;
        cin >> x >> y;
        p[i] = P(x, y);
    }

    if (!sgn(cross(p[0]-p[1], p[2]-p[3]))) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
}

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

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

C++: #include <bits/stdc++.h>
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;

    double X1 = x2-x1, Y1 = y2-y1;
    double X2 = x4-x3, Y2 = y4-y3;

    if(abs(X1*Y2-X2*Y1) < 0.00000001) cout << "YES" << endl;
    else cout << "NO" << endl;
  }
}

C++: #include<cstdio>
#include<iostream>
#include<algorithm>
#include<vector>
#include<set>
#include<string>
#include<functional>
#include<queue>
#include<stack>
#include<math.h>
#define INF 999999
#define EPS 1.0e-6

using namespace std;

typedef long long ll;


int main()
{
	int n;
	cin >> n;
	double x1, y1, x2, y2, x3, y3, x4, y4;
	for(int i=0;i<n;i++){
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		double a = (y2 - y1)*(x4 - x3) - (y4 - y3)*(x2 - x1);
		if (abs(a) < EPS )printf("YES\n");
		else printf("NO\n");
	}
	
	return 0;
}