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++: //Parallelism
#include<bits/stdc++.h>
using namespace std;

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

  return 0;
}

C++: #include <iostream>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <string>
#include <math.h>
#include <functional>
#include <algorithm>

typedef long long Int;
#define REP(i,n) for(int i = 0 ; i < n ; ++i)
using namespace std;

int main(){
	double p[8];
	int n;
	cin >> n;

	REP(i, n){

		REP(i, 8){
			cin >> p[i];
		}

		string ans = (p[3] - p[1]) / (p[2] - p[0]) == (p[7] - p[5]) / (p[6] - p[4]) ? "YES" : "NO";


		cout << ans << endl;
	}
	return 0;
}

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

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

int main(){
	double x1,y1,x2,y2,x3,y3,x4,y4;
	double AB,CD;
	int n;
	cin>>n;
	while(n--){
		cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;

		AB = (y1-y2)/(x1-x2);
		CD = (y3-y4)/(x3-x4);
		if(AB == CD)
			cout<<"YES"<<endl;

		else
			cout<<"NO"<<endl;
	}
	return 0;
}

C++: #include <iostream>
#include <fstream>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <list>
#include <utility>
#include <cmath>
#include <sstream>
#define F first
#define S second
#define FOR(i,n) for(int i=0;i<(int)n;i++)
#define FORI(i,k,n) for(int i=k;i<(int)n;i++)
using namespace std;
int main() {
	int n;
	cin >> n;
	for (int l = 0; l < n; l++) {
		double x[4], y[4], v[2];
		for (int i = 0; i < 4; i++) {
			cin >> x[i] >> y[i];
			x[i]*=100000;
			y[i]*=100000;
		}
		v[0] = (y[1] - y[0]) / (x[1] - x[0]);
		v[1] = (y[3] - y[2]) / (x[3] - x[2]);
		if (x[0] == x[1] && x[2] == x[3]) {
			cout << "YES" << endl;
			continue;
		} else if (x[0] == x[1] || x[2] == x[3]) {
			cout << "NO" << endl;
			continue;
		} else if (v[0] == v[1]) {
			cout << "YES" << endl;
			continue;
		}
		cout << "NO" << endl;
		continue;
	}
	return 0;
}

C++: #include <stdio.h>
#include <complex>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef complex<double> P;
#define EPS (1e-12)

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

int main() {
    int T;
    scanf("%d", &T);
    while (T--) {
        double x1, y1, x2, y2, x3, y3, x4, y4;
        scanf("%lf%lf", &x1, &y1);
        scanf("%lf%lf", &x2, &y2);
        scanf("%lf%lf", &x3, &y3);
        scanf("%lf%lf", &x4, &y4);
        const bool a = (fabs(cross(P(x1-x2, y1-y2), P(x3-x4, y3-y4))) < EPS);
        puts(a ? "YES" : "NO");
    }
    return 0;
}

C++: #define	_USE_MATH_DEFINES
#include <iostream>
#include <algorithm>
#include <functional>
#include <vector>
#include <cstdio>
#include <string>
#include <cmath>
#include <cfloat>
#include <map>
#include <queue>
#include <stack>
#include <list>
using namespace std;

int main(){

	int n;
	cin>>n;
	double x1,y1,x2,y2,x3,y3,x4,y4;
	double a,b;
	while(n>0){
		
	cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
		
		a=(y2-y1)/(x2-x1);
		b=(y4-y3)/(x4-x3);
		
		if(a==b)
			cout<<"YES"<<endl;
		else
			cout<<"NO"<<endl;
		
		n--;
	}
	
	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;
		if ((x2 - x1 == 0) && (x4 - x3 == 0)) cout << "YES\n";
		else
		cout << ((((y2 - y1) / (x2 - x1) - (y4 - y3) / (x4 - x3)) == 0) ? "YES\n" : "NO\n");
	}

	return 0;
}

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

int main()
{
    double a,s,d,f,g,h,j,k;
    double q,w,e,r;
        int n;
    cin>>n;
    for(int i=0; i<n; i++){
        cin>>a>>s>>d>>f>>g>>h>>j>>k;
        q=d-a;
    w=f-s;
    e=j-g;
    r=k-h;
        int key=q*r-w*e;
        if(!key)cout<<"YES"<<endl;
        else  cout<<"NO"<<endl;
    }
    return 0;
}

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

int main()
{
	int n;
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		double x[4], y[4];
		double a, b;
		cin >> x[0] >> y[0] >> x[1] >> y[1] >> x[2] >> y[2] >> x[3] >> y[3];
		a = (x[2] - x[3]) * (y[0] - y[1]);
		b = (x[0] - x[1]) * (y[2] - y[3]);
		bool h = abs(a - b) < 0.0000001;
		if (h)
		{
			cout << "YES" << endl;
		}
		else
			cout << "NO" << endl;
	}




	return 0;
}

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

int judge(double a1,double a2,double b1,double b2,double c1,double c2,double d1,double d2);

int main(){
	int n;
	double a1,a2,b1,b2;
	double c1,c2,d1,d2;
	
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a1>>a2>>b1>>b2>>c1>>c2>>d1>>d2;
		if(judge(a1,a2,b1,b2,c1,c2,d1,d2))
			cout<<"YES"<<endl; 
		else
			cout<<"NO"<<endl;
	}

}


int judge(double a1,double a2,double b1,double b2,double c1,double c2,double d1,double d2){
	double aa,bb;
	aa=(b2-a2)/(b1-a1);
	bb=(d2-c2)/(d1-c1);
//	cout<<aa<<" "<<bb<<endl;
	if(aa==bb)return 1; else return 0;
}

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

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

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