Go: package main

import (
        "fmt"
        "math/big"
)

func main() {
        var x1, x2, x3, x4, y1, y2, y3, y4 big.Float
        var n int
        fmt.Scanf("%d", &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)
                var lx, ly, mx, my, mul1, mul2, sub, zz big.Float
                lx.Sub(&x2, &x1)
                ly.Sub(&y2, &y1)
                mx.Sub(&x4, &x3)
                my.Sub(&y4, &y3)
                mul1.Mul(&lx, &my)
                mul2.Mul(&ly, &mx)
                sub.Sub(&mul1, &mul2)
                zz.SetFloat64(0.0)

                if sub.Cmp(&zz) == 0 {
                        fmt.Println("YES")
                } else {
                        fmt.Println("NO")
                }
        }
}

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 <string>
using namespace std;
int main()
{
    int N;
	cin>>N;
	while(N--){
		bool ans;
		double x1,y1,x2,y2,x3,y3,x4,y4;
		cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
		double a,b;
		if(x1==x2){
			x3==x4?ans=true:ans=false;
		}else if(x3==x4){
			ans=false;
		}else{
			a=(y1-y2)/(x1-x2);
			b=(y3-y4)/(x3-x4);
			a==b?ans=true:ans=false;
		}
		ans?puts("YES\n"):puts("NO\n");
	}
    return 0;
}

C++: #include<vector>
#include<iostream>
#include<cstdio>
using namespace std;
double x1,y1,x2,y2,x3,y3,x4,y4;
int n;
int main()
{
  scanf("%d",&n);
  for(int i = 0;i < n;i++){
    double x1,y1,x2,y2,x3,y3,x4,y4;
    scanf("%lf%lf%lf%lf%lf%lf%lf%lf",&x1,&y1,&x2,&y2,&x3,&y3,&x4,&y4);
    if((y2-y1)/(x2-x1)==(y4-y3)/(x4-x3)) printf("YES\n");
    else printf("NO\n");
    
  }
  return 0;
}

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

#define P complex<double>

int main(){
  int n;
  P a,b,c,d;

  cin >> n;
  for( int loop=0;loop<n;loop++ ){
    cin >> a.real() >> a.imag();
    cin >> b.real() >> b.imag();
    cin >> c.real() >> c.imag();
    cin >> d.real() >> d.imag();

    P x=a-b, y=c-d;

    if( abs(x.real()-y.real()) < 1.0e-4  &&
	abs(x.imag()-y.imag()) < 1.0e-4  )
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }

  return 0;
}

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

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

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

C++: #include<stdio.h>

int main(){

int N;
double x1,x2,x3,x4,y1,y2,y3,y4;
double a1=0,a2=0;

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);
a1=(y1-y2)/(x1-x2);a2=(y3-y4)/(x3-x4);
if(a1==a2)printf("YES\n");
else if(a1!=a2)printf("NO\n");
}
return 0;
}

C++: #include <complex>
#include <iostream>
#define REP(i,n) for(int i = 0; i < (n); ++i)
using namespace std;

// ?¨±?????????????????
#define EPS (1e-10)
// 2??????????????????????????????????????????
#define EQ(a,b) (abs((a)-(b)) < EPS)

typedef complex<double> P;

// ?????? (cross product) : a??b = |a||b|sin??
double cross(P a, P b) {
  return (a.real() * b.imag() - a.imag() * b.real());
}

// 2??´?????????????????? : a//b <=> cross(a, b) = 0
int is_parallel(P a1, P a2, P b1, P b2) {
  return EQ( cross(a1-a2, b1-b2), 0.0 );
}
 
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;
		P a(x1,y1), b(x2,y2), c(x3,y3), d(x4,y4);
        if ( is_parallel(a,b,c,d) ) {
            cout << "YES" << endl;
        }
        else {
            cout << "NO" << endl;
        }
	}
    return 0;
}

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

C++: #include<stdio.h>
#include<math.h>
int main(){
	int n,i;
	float x1,y1,x2,y2,x3,y3,x4,y4;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%f%f%f%f%f%f%f%f",&x1,&y1,&x2,&y2,&x3,&y3,&x4,&y4);
		if((x2-x1==x4-x3)&&(y2-y1==y4-y3)){
			if((x4-x2==x3-x1)&&(y4-y2==y3-y1)){
				printf("YES\n");
			}else{
				printf("NO\n");
			}
		}else{
			printf("NO\n");
		}
	}
	return 0;
}

C++: #include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <string>
#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( ((y1-y2)/(x1-x2)) == ((y3-y4)/(x3-x4)) ){
			cout << "YES" << "\n" ;
		}
		else if( ((y1-y2)/(x1-x2)) == -((y3-y4)/(x3-x4)) ){
			cout << "YES" << "\n" ;
		}
		else{
			cout << "NO" << "\n" ;
		}
	}
	return 0;
}

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

int hantei(double x1,double x2,double x3,double x4,double y1,double y2,double y3,double y4);
int main(void){
	double x1,x2,x3,x4;
	double y1,y2,y3,y4;
	int i,n;
	int result=0;
	
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%lf %lf %lf %lf",&x1,&y1,&x2,&y2);
		scanf("%lf %lf %lf %lf",&x3,&y3,&x4,&y4);
		result=hantei(x1,y1,x2,y2,x3,y3,x4,y4);
		if(result==1){
			puts("YES");
		}else{
			puts("NO");
		}			
	}
	return 0;
}



int hantei(double x1,double x2,double x3,double x4,double y1,double y2,double y3,double y4){
	double kata1,kata2;
	kata1=(y1-y2)/(x1-x2);
	kata2=(y3-y4)/(x3-x4);
	//printf("%lf %lf",kata1,kata2);
	if(kata1==kata2)return 1;
	else return 0;
}

C++: #include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#define EPS 0.00001
using namespace std;

int main()
{
  double x1,x2,x3,x4,y1,y2,y3,y4;
  double dx1,dy1,dx2,dy2;
  int n;
  int i;

  cin>>n;
  for(i=0;i<n;i++){
    cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
    dx1=x2-x1;
    dy1=y2-y1;
    dx2=x4-x3;
    dy2=y4-y3;

    if(abs(dx1)<EPS && abs(dx2)<EPS)
      cout<<"YES"<<endl;
    else if(abs(dx1)<EPS || abs(dx2)<EPS)
      cout<<"NO"<<endl;
    else if(abs(dy1/dx1-dy2/dx2) < EPS)
      cout<<"YES"<<endl;
    else
      cout<<"NO"<<endl;
  }
}

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].first == p[1].first && p[2].first == p[3].first)
		{
			cout << "YES" << endl;
		}
		else if(p[0].first == p[1].first || p[2].first == p[3].first)
		{
			cout << "NO" << endl;
		}
		else
		{
			double a1 = (p[1].second - p[0].second) / (p[1].first - p[0].first);
			double a2 = (p[3].second - p[2].second) / (p[3].first - p[2].first);
			if(fabs(a2 - a1) < 1e-8)
			{
				cout << "YES" << endl;
			}
			else
			{
				cout << "NO" << endl;
			}
		}
	}
}

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