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[1] == fpoints[3] {
			fmt.Println("YES")
			continue
		}
		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++: #define _USE_MATH_DEFINES
 
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <math.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;
		if((y1-y2)*(x3-x4)==(y3-y4)*(x1-x2)){
			cout << "YES" << endl;
		}else{
			cout << "NO" << endl;
		}
	}

	return 0;
}

C++: #include<iostream>
#include<string>
#include<vector>
#include<cstdio>
#include<sstream>
#include<algorithm>
#include<cmath>
#include<map>
#include<functional>
#include<queue>
#include<stack>
#include<set>
#include<math.h>
using namespace std;
#define SZ(n)  (int)n.size()
#define dump(x) cerr<<#x<<" = "<<(x)<<endl;
#define debug(x)cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define MP make_pair
#define PB push_back
	double EPS=1e-10;
	bool same(double a,double b){
		if(fabs(a-b)<=EPS)return 1;
		else return 0;
	}
	
	
	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 a1=(y1-y2)/(x1-x2);
		double a2=(y3-y4)/(x3-x4);
		if(a1==a2)cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
	}
	
	return 0;
}

C++: #include<iostream>
#include<cmath>
using namespace std;
#define EPS 1e-10
 
double a,b,c,d,e,f,g,h;
double det(){
    double dx1,dy1,dx2,dy2;
    dx1 = a-c;
    dy1 = b-d;
    dx2 = e-g;
    dy2 = f-h;
    return dx1*dy2 - dy1*dx2;
}
int main(){
    int n;
    cin>>n;
    while(n--){
        cin>>a>>b>>c>>d>>e>>f>>g>>h;
        cout<<(fabs(det())<EPS?"YES":"NO")<<endl;
    }
    return 0;
}

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

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

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

const double EPS = 1E-15;

inline bool cmp(double x, double y){
  return abs(x-y) < EPS;
}

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;
    double s=(x1-x2)*(y1-y2), t=(x3-x4)/(y3-y4);
      if(s==t) 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 dataSets;
  cin >> dataSets;
  for(int i=0;i<dataSets;i++){
    bool flag=false;
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;

    
    if((x2-x1)==0 || (x4-x3)==0){
      if((x2-x1) == (x4-x3)){
	if(x1==x3){
	  flag = true;
	}
      }
    }


    // cout << (y2-y1)/(x2-x1) << endl;
    // cout << (y4-y3)/(x4-x3) << endl;
    if((y2-y1)/(x2-x1) == (y4-y3)/(x4-x3)){
      // cout << "here" << endl;
      flag = true;
    }

    if(flag){
      cout << "YES" << endl;
    }else{
      cout << "NO" << endl;
    }
    
  }

}

C++: #include <stdio.h>

int main(){
	int num;
	double x1, y1;
	double x2, y2;
	double x3, y3;
	double x4, y4;
	double ax, ay;
	double bx, by;
	float s;
				
	scanf("%d", &num);	
	for(int i = 0; i < num; i++){
		scanf("%lf %lf %lf %lf %lf %lf %lf %lf", &x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4);

		ax = x2 - x1;
		ay = y2 - y1;
		bx = x4 - x3;
		by = y4 - y3;
		s = ax*by - ay*bx;
		if(-0.000001 < s && s < 0.000001){
			printf("YES\n");
		}else{
			printf("NO\n");
		}
	}
	
	return 0;
}

C++: #include <iostream>
using namespace std;
#define INF 1e+15

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

C++: #include <iostream>
#include <cmath>
 
using namespace std;
 
const double EPS = 1e-10;
 
int
main()
{
    int n;
    double x1, y1, x2, y2, x3, y3, x4, y4;
 
    cin >> n;
 
    while (n--) {
        cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
 
        if (fabs((x2 - x1) * (y4 - y3) - (x4 - x3) * (y2 - y1)) < EPS)
            cout << "YES" << endl;
        else
            cout << "NO" << endl;
    }
 
    return 0;
}

C++: #include<stdio.h>

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

	scanf("%d",&n);
	for(int x=0;x<n;x++)
	{
		scanf("%lf %lf %lf %lf %lf %lf %lf %lf",&x1,&y1,&x2,&y2,&x3,&y3,&x4,&y4);

		x2-=x1;
		y2-=y1;
		x1=0;
		y1=0;
		x4-=x3;
		y4-=y3;
		x3=0;
		y3=0;

		double p,q;
		p=x2/x4;
		q=y2/y4;

		if(p==q)
		{
			printf("YES\n");
		}
		else
		{
			printf("NO\n");
		}
	}
	return 0;
}

C++: #include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<vector>
#include<functional>
using namespace std;
int main() {
	int n;
	double x1, y1, x2, y2, x3, y3, x4, y4;
	cin >> n;
	for (int z = 0; z < n; z++) {
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		double a = 99999, b = 99999;
		a = (x2 - x1)*(y2 - y1);
		b = (x4 - x3)*(y4 - y3);
		if (a == b) cout << "YES" << endl;
		else cout << "NO" << endl;
	}
}

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

using namespace std;

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)

typedef complex<double> P;
typedef vector<P> VP;
const double EPF = 1e-6;

#define X real()
#define Y imag()
#define EQ(x,y) (abs(x-y) < EPF)

double dot(P a, P b) {
  return (conj(a)*b).X;
}
double cross(P a, P b) {
  return (conj(a)*b).Y;
}
double distPP(P a, P b) {
  return sqrt(dot(a-b,a-b));
}
P crosspoint(P a, P b, P c, P d) {//ac , bd
  double d1 = cross(d-b,b-a);
  double d2 = cross(d-b,c-a);
  if(EQ(d1,0) & EQ(d2,0)) return a;
  if(EQ(d2,0)) return a;
  return a + (c-a)*d1/d2;
}
P normal_vector(P a) {
  P b(-a.Y, a.X);
  return b;
}
P polar(double r, double theta) {
  P a(r*cos(theta),r*sin(theta));
  return a;
}

int main() {
  int n;
  scanf("%d",&n);
  REP(i,n) {
    double x,y;
    P a,b,c,d;
    scanf("%lf %lf", &x, &y);
    a = P(x,y);
    scanf("%lf %lf", &x, &y);
    b = P(x,y);
    scanf("%lf %lf", &x, &y);
    c = P(x,y);
    scanf("%lf %lf", &x, &y);
    d = P(x,y);
    
    if(EQ(cross(a-b, c-d),0))printf("YES\n");
    else printf("NO\n");
  }
  return 0;
}