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

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++) {
		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<algorithm>
using namespace std;

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

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

typedef struct{
  double x,y;
}point;

int main(void){
  int i,n;
  char str[200];
  point A,B,C,D;

  fgets(str,sizeof(str),stdin);
  sscanf(str,"%d",&n);
  for(i=0;i<n;i++){
    fgets(str,sizeof(str),stdin);
    sscanf(str,"%lf %lf %lf %lf %lf %lf %lf %lf",&A.x,&A.y,&B.x,&B.y,&C.x,&C.y,&D.x,&D.y);
    if((B.y-A.y)/(B.x-A.x) == (D.y-C.y)/(D.x-C.x)){
      printf("YES\n");
    }
    else{
      printf("NO\n");
    }
  }
  return 0;
}

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

#define EPS 1e-10

int main(){
  int n;cin>>n;
  for(int i=0;i<n;++i){
    double a,b,c,d,e,f,g,h;cin>>a>>b>>c>>d>>e>>f>>g>>h;
    double dx1,dy1,dx2,dy2;
    dx1 = a - c;
    dy1 = b - d;
    dx2 = e - g;
    dy2 = f - h;
    //cout << dx1 << " " << dy1 << " " << dx2 << " "<<dy2<<endl;
    double det = fabs(dx1*dy2 - dx2*dy1);
    (fabs(det)<EPS) ? cout<<"YES"<<endl : cout<<"NO"<<endl;
  }
  return EXIT_SUCCESS;
}

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("YES\n");
		}
		else
		{
			printf("NO\n");
		}
	}
	return 0;
}

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

using namespace std;

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

	cin >> n;

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

	for (int i = 0; i < n; i++)
	{
		if (abs((x2[i] - x1[i]) / (y2[i] - y1[i])) == abs((x4[i] - x3[i]) / (y4[i] - y3[i])))
		{
			cout << "YES" << endl;
		}
		else
		{
			cout << "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[3] - y[2]) == (x[2] - x[3]) * (y[1] - y[0]))
			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++: #include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int main(void){
    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);
    (a==b)? cout<<"YES"<<endl : cout<<"NO"<<endl;
    }
    return 0;
}

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

int main()
{
	const double EPS = 1e-3;
	const double PI = 4.*atan(1.);

	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;
		complex<double> A(x1,y1),B(x2,y2),C(x3,y3),D(x4,y4);
		complex<double> e1 = A-B;
		complex<double> e2 = C-D;
		double a = arg(e1/e2);
		cout << ( abs(a)<EPS || abs(a)>PI-EPS ? "YES" : "NO" ) << endl;
	}
	return 0;
}

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

int main()
{
    int n;
    cin>>n;
    while(n--){
        pair<double,double>a[4];
        for(int i=0;i<4;i++){
            cin>>a[i].first>>a[i].second;
        }
        if(abs((a[1].first-a[0].first)*(a[3].second-a[2].second)-(a[3].first-a[2].first)*(a[1].second-a[0].second))<0)
            cout<<"YES"<<endl;
        else
            cout<<"NO"<<endl;
    }
    return 0;
}

C++: #include <iostream>
#include <float.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 ab_slope = (y2-y1)/(x2-x1);
		double cd_slope = (y4-y3)/(x4-x3);
		if(ab_slope == cd_slope){
			cout<<"YES"<<endl;
		}else{
			cout<<"NO"<<endl;
		}
		
	}
	return 0;
}

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

using namespace std;
typedef pair<double, double> P;

void solve()
{
	P p[4];
	int n;
	cin >> n;
	while(n--)
	{
		cin >> p[0].first >> p[0].second >> p[1].first >> p[1].second >> p[2].first >> p[2].second >> p[3].first >> p[3].second;
		if(p[0].second == p[1].second && p[2].second == p[3].second)
		{
			cout << "YES" << endl;
		}
		else if(p[0].second == p[1].second || p[2].second == p[3].second)
		{
			cout << "NO" << endl;
		}
		else
		{
			double a1 = (p[1].first - p[0].first) / (p[1].second - p[0].second);
			double a2 = (p[3].first - p[2].first) / (p[3].second - p[2].second);
			if(fabs(a2 - a1) < 1e-8)
			{
				cout << "YES" << endl;
			}
			else
			{
				cout << "NO" << endl;
			}
		}
	}
}

int main()
{
	solve();
	return(0);
}

C++: #include <iostream>
#include <cstdio>
#include <algorithm>
#include <queue>
#include <vector>
#include <iterator>

using namespace std;

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

C++: #include<bits/stdc++.h>
using namespace std;
signed main(void){
	double k1,k2;
	double x[4],y[4];
	int T;
	cin>>T;
	for(int t=1;t<=T;t++){
		for(int i=0;i<4;i++)
			cin>>x[i]>>y[i];
		k1=(y[1]-y[0])/(x[1]-x[0]);
		k2=(y[3]-y[2])/(x[3]-x[2]);
		if(fabs(k1-k2)<=1e-6)
			cout<<"YES"<<endl;
		else
			cout<<"NO"<<endl;
	}
}

C++: #include<iostream>
using namespace std;
int main(){
	double a,b,c,d,e,f,g,h;
	int n;
	int x,y;
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>a>>b>>c>>d>>e>>f>>g>>h;
		x=(d-b)/(c-a);
		y=(h-f)/(g-e);
		if((d-b)/(c-a)==(h-f)/(g-e)){cout<<"YES"<<endl;}
		else {cout<<"NO"<<endl;}
	}
}

C++: #include<cmath>
#include<iostream>
#include<algorithm>
#include<iomanip>
#include<vector>
#include<string>
#include<queue>
#include<stack>
#include<cstdio>
#include<map>
#define rep(i,n) for(int i=0;i<n;i++)
#define fori(i,k,n) for(int i=k;i<n;i++)
using namespace std;
const int dx[4] = { 0, 1, 0, -1 }, dy[4] = { 1, 0, -1, 0 };
const int dX[8] = { 0, 1, 1, 1, 0, -1, -1, -1 }, dY[8] = { 1, 1, 0, -1, -1, -1, 0, 1 };
/*
(char)'1' - (int)48 = (int)1; 


*/


int main()
{
	int n;
	cin >> n;
	while (n--){
		double x, X, y, Y;
		cin >> x >> y >> X >> Y;
		double a, b;
		a = (Y - y) / (X - x);
		cin >> x >> y >> X >> Y;

		if (a == (Y - y) / (X - x))cout << "YES" << endl;
		else
			cout << "NO" << endl;
	}
	return 0;

}