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<iostream>
using namespace std;
 
int main() {
    double n,x[4],y[4],judge1,judge2;
    cin >> n;
    for(int i=0;i<n;i++){
        for(int j=0;j<4;j++) cin>>x[j]>>y[j];
        judge1=(y[1]-y[0])/(x[1]-x[0]);
        judge2=(y[3]-y[2])/(x[3]-x[2]);
        if(judge1==judge2)cout << "YES";
        else cout << "NO";
        cout << endl;
    }
}

C++: #include <iostream>
 
using namespace std;
 
int main(){
    int n;
    double x[100], y[100];
    cin>>n;
    while(n>0){
        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;
            n--;
        }
        else {
            cout<<"NO"<<endl;
            n--;
        }
    }
}

C++: #include <iostream>

using namespace std;

int n;

double xa,xb,xc,xd,ya,yb,yc,yd,ta,tb,tc,td;

int main(){

	int i;

	cin >> n;

	for(i=0;i<n;i++){

		cin >> xa >> ya >> xb >> yb >> xc >> yc >> xd >> yd;

		ta = xa - xb;

		tb = ya - yb;

		tc = xc - xd;

		td = yc - yd;

		if(tc/td == ta/tb) cout << "YES" << endl;

		else cout << "NO" << endl;

	}

	return 0;

}

C++: #include <bits/stdc++.h>

using namespace std;

#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)

typedef complex<double> P;
struct Line : public vector<P>
{
  Line(P a=P(), P b=P()) {
    push_back(a); push_back(b);
  }
};
typedef Line Segment;

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

bool is_parallel(Segment const& s, Segment const& t) {
  return abs(cross(s[1]-s[0], t[1]-t[0])) < 1E-7;
}

int main() {
  int N; cin >> N;
  rep(tc, 2) {
    P ps[4]; rep(i, 4) cin >> ps[i].real() >> ps[i].imag();
    cout << (is_parallel(Segment(ps[0], ps[1]), Segment(ps[2], ps[3])) ? "YES\n" : "NO\n");
  }
}

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

int main()
{
	int n;
	cin >> n;
	
	float point[4][2];
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < 4; j++) {
			for (int k = 0; k < 2; k++) {
				cin >> point[j][k];
			}
		}

		if ((point[1][1] - point[0][1]) / (point[1][0] - point[0][0]) == (point[3][1] - point[2][1]) / (point[3][0] - point[2][0]))
			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 n;
	cin>>n;
for(int i=0;i<n;i++)
{
	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(){
	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)) == 0) ? "YES\n" : "NO\n");
	}

	return 0;
}

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

typedef complex<double> xy_t;
double cross_product(xy_t a, xy_t b) { return (conj(a)*b).imag(); }
const double eps = 1e-11;
double x[4],y[4];
int N;
int main() {
	cin >> N;
	for (int i=0; i<N; ++i) {
		for (int i=0; i<4; ++i) {
			cin >> x[i] >> y[i];
			x[i] *= 1e5;
			y[i] *= 1e5;
		}
		xy_t a[2] = {
					xy_t(x[0],y[0]) - xy_t(x[1],y[1]),
					xy_t(x[2],y[2]) - xy_t(x[3],y[3])
				};
		bool p = abs(cross_product(a[0],a[1])/2) == 0;
		cout << ( p ? "Yes" : "No") << endl;
	}
}

C++: #include <cstdio>
#include <cstring>
#include <algorithm>
#include <string>
#include <cmath>
#include <stack>
#include <vector>
#include <iostream>


using namespace std;

int main()
{
	int n;
	scanf("%d", &n);
	for (int i = 0; i < n; ++i)
	{
		double x[4], y[4];
		for (int j = 0; j < 4; ++j)
			scanf("%lf %lf", x+j, y+j);

		double x1 = x[1] - x[0];
		double y1 = y[1] - y[0];
		double x2 = x[3] - x[2];
		double y2 = y[3] - y[2];
		if (abs(x1-x2) < 0.001 || abs(y1-y2*x1/x2) < 0.001)
			puts("YES");
		else
			puts("NO");
	}

	return 0;
}

C++: #include<iostream>

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

	return 0;
}

C++: #include <iostream>
#include <cmath>

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;
		
		if (abs(x2-x1)==0||abs(x4-x3)==0) {
			if (abs(x2-x1)==0 && abs(x4-x3)==0) {
				cout << "YES"<<endl;
			}
			else{
				cout << "NO" << endl;
			}
		}
		else {
			if (abs((y2-y1)/(x2-x1)-(y4-y3)/(x4-x3))<0.000001) {
				cout << "YES" << endl;
			}
			else {
				cout << "NO" << endl;
			}

		}

		
	}
	
	return 0;
}

C++: #include <iostream>
using namespace std;
void judge(double,double,double,double,double,double,double,double);

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

	cin >> n;
	for (int i = 0;i < n;i++) {
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		judge(x1, y1, x2, y2, x3, y3, x4, y4);
	}
	
	return 0;
}

void judge(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4) {
	double abx = x2 - x1;
	double aby = y2 - y1;
	double cdx = x4 - x3;
	double cdy = y4 - y3;
	if (abx * cdy - aby * cdx == 0) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}

	return;

}

C++: #include <iostream>
#include <cmath>

using namespace std;

void swap(double &x, double &y, double &xx, double &yy) 
{
  double tmp_x = x;
  double tmp_y = y;
  x = xx;
  y = yy;
  xx = tmp_x;
  yy = tmp_y;
}

bool isZero(double x) 
{
  return x < 0.00001;
}

void compute(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4) 
{
  if (x1 > x2) swap(x1, y1, x2, y2);
  if (x3 > x4) swap(x3, y3, x4, y4);

  double diff_x12 = x2 - x1;
  double diff_y12 = y2 - y1;
  double diff_x34 = x4 - x3;
  double diff_y34 = y4 - y3;

  if (isZero(diff_x12) && isZero(diff_y12))
    cout << "NO" << endl;
  else if (isZero(diff_x34) && isZero(diff_y34))
    cout << "NO" << endl;  
  else if (!isZero(diff_x12) && !isZero(diff_x34)) {
    double ab = diff_y12 / diff_x12;
    double cd = diff_y34 / diff_x34;
    if (isZero(abs(ab - cd)))
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }
  else if (isZero(diff_x12) && isZero(diff_x34)) 
    cout << "YES" << endl;  
  else
    cout << "NO" << endl;  
}

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