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;

const double EPS=1E-12;

int main(){
  int n;
  cin>>n;
  complex<double> a, b, c, d;
  while(n--){
    cin>>a.real()>>a.imag()>>b.real()>>b.imag()>>c.real()>>c.imag()>>d.real()>>d.imag();
    a=a-b;
    c=c-d;
    cout<<(fabs(a.real()*c.imag()-a.imag()*c.real())<=EPS?"YES":"NO")<<endl;
  }

  return 0;
}

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

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

C++: #define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <sstream>
#include <utility>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;
#define all(c) (c).begin(), (c).end()
#define loop(i,a,b) for(ll i=a; i<ll(b); i++)
#define rep(i,b) loop(i,0,b)
#define each(e,c) for(auto&e:c)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define lb lower_bound
#define ub upper_bound
#ifdef DEBUG
#define dump(...) (cerr<<#__VA_ARGS__<<" = "<<(DUMP(),__VA_ARGS__).str()<<" ["<<__LINE__<<"]"<<endl)
struct DUMP:ostringstream{template<class T>DUMP &operator,(const T&t){if(this->tellp())*this<<", ";*this<<t;return *this;}};
#else
#define dump(...)
#endif

int main(){
    int n; cin>>n;
    rep(_,n){
        ll x[2][2], y[2][2];
        rep(i,2){
            rep(j,2){
                double x_,y_;
                cin >> x_ >> y_;
                x[i][j] = (x_ + 1e-9)*100000;
                y[i][j] = (y_ + 1e-9)*100000;
            }
        }
        ll dx1=x[0][0]-x[0][1], dy1=y[0][0]-y[0][1];
        ll dx2=x[1][0]-x[1][1], dy2=y[1][0]-y[1][1];
        dump(dx1,dx2,dy1,dy2);
        puts(dx1*dy2==dx2*dy1 ? "YES" : "NO");
    }
}

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

int main(){
	int n;
	double x[4], y[4];
	int xi[4], yi[4];
	scanf("%d", &n);
	for(int 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]);

		for(int i = 0; i < 4; i++){
			xi[i] = (int)(x[i] * 100000);
			yi[i] = (int)(y[i] * 100000);
		}

		if(xi[0] - xi[1] == 0){
			if(xi[2] - xi[3] == 0){
				printf("YES\n");
			}else{
				printf("NO\n");
			}
		}else{
			if((yi[0] - yi[1])*(xi[2] - xi[3]) == (xi[0] - xi[1])*(yi[2] - yi[3])){
				printf("YES\n");
			}else{
				printf("NO\n");
			}
		}
	}
	return 0;
}

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

using namespace std;

int main() {
    int n;
    cin >> n;
    while (n--) {
        double x1,x2,x3,x4,y1,y2,y3,y4,p1,p2;
        cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
        p1 = (y2-y1)/(x2-x1);
        p2 = (y4-y3)/(x4-x3);
        if(p1 == p2)
            cout << "YES" << endl;
        else
            cout << "NO" << endl;
    }
    
    return 0;
}

C++: #include<stdio.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("YES\n");
		else
			printf("NO\n");
	}
	return 0;
}

C++: #include <iostream>
#include <cmath>
using namespace std;
const long double EPS = 1e-9;
int main() {
	double x1, y1, x2, y2, x3, y3, x4, y4;
	int n;
	double veku1[2];
	double veku2[2];
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		veku1[0] = x2 - x1;
		veku1[1] = y2 - y1;
		veku2[0] = x4 - x3;
		veku2[1] = y4 - y3;
		if (fabs(veku1[0]*veku2[1]-veku1[1]*veku2[0]) <= EPS) {
			/*veku1[0] = x3 - x1;
			veku1[1] = y3 - y1;
			veku2[0] = x4 - x1;
			veku2[1] = y4 - y1;
			if (fabs(veku1[0]*veku2[1]-veku1[1]*veku2[0]) <= 0.0000001) {
				cout << "NO" << endl;
			} else {*/
				cout << "YES" << endl;
			//}
		} else {
			cout << "NO" << endl;
		}
	}
	return 0;
}

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

int n;

void solve()
{
	double x[4],y[4],px[2],py[2];


	for(int i = 0; i < 4; i++){
		cin >> x[i] >> y[i];
	}

	px[0] = x[0] - x[2];
	px[1] = x[1] - x[3];
	py[0] = y[0] - y[2];
	py[1] = y[1] - y[3];

	for(int i = 0; i < 2; i++){
		if(px[i] < 0)
			px[i] *= -1;
		if(py[i] < 0)
			py[i] *= -1;
	}
	

	if(px[0] == px[1] && py[0] == py[1])
		cout << "YES";
	else
		cout << "NO";
	cout << endl;

}

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


	return 0;
}

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

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

C++: #include <iostream>
#include <sstream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <complex>
#include <algorithm>
#include <cstdio>
#include <cmath>
using namespace std;

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
#define ALL(a)  (a).begin(),(a).end()
#define REP(i,n) for(int i=0;i<(n);++i)
const double EPS = 1e-10;
const double PI  = acos(-1.0);
#define dump(x) cerr << "  (L" << __LINE__ << ") " << #x << " = " << (x) << endl;
#define dumpv(x) cerr << "  (L" << __LINE__ << ") " << #x << " = "; REP(q,(x).size()) cerr << (x)[q] << " "; cerr << endl;
template<typename T1, typename T2>
ostream& operator<<(ostream& s, const pair<T1, T2>& d) {return s << "(" << d.first << "," << d.second << ")";}


double cross(complex<double>& a, complex<double>& b) {
  return a.real() * b.imag() - a.imag() * b.real();
}

int main() {
  int T; cin >> T;
  REP(t, T) {
    vector<double> in(8);
    REP(i, 8) cin >> in[i];
    
    complex<double> a(in[2]-in[0], in[3]-in[1]);
    complex<double> b(in[6]-in[4], in[7]-in[5]);
    double exter_product = cross(a, b);
    if (abs(exter_product) < EPS) {
      cout << "YES" << endl;
    } else {
      cout << "NO" << endl;
    }
  }
}

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