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)
		}
		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++: #include <iostream>
#include <cmath>
using namespace std;
int main(void) {
  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 ((y1 - y2) / (x1 - x2) == (y3 - y4) / (x3 - x4)) {
      cout << "YES";
    } else {
      cout << "NO";
    }
    cout << endl;
  }
  return 0;
}

C++: #include <iostream>
#include <complex>
using namespace std;
typedef complex<double> P;
const double EPS = 1e-9;
int main(){
	int N;
	cin >> N;
	while(N--){
		P a,b,c,d;
		cin >> a.real() >> a.imag() >> b.real() >> b.imag() >> c.real() >> c.imag() >> d.real() >> d.imag();
		P one = a-b;
		P two = c-d;
		bool f = false;
		if( abs(one.imag()) < EPS || abs(two.imag()) < EPS ){
			f = abs(one.imag()) < EPS && abs(two.imag()) < EPS;
		}else{
			f = abs(one.real()/one.imag() - two.real()/two.imag()) < EPS;
		}
		cout << (f?"YES":"NO") << endl;
	}
}

C++: #include<iostream>
#include<queue>
#include<string>
#include<stack>
#include<cstdio>
#include<algorithm>

using namespace std;

int main(void)
{
  double x,y;
  double x1,y1;
  int n;
  int i;
  long double a=0,b=;
  int k1=0,k2=2;

  cin>>n;

  for(i=0;i<n;i++)
    {
      cin>>x>>y>>x1>>y1;
      if(x1-x!=0)
        a=(y1-y)/(x1-x);
      else
        a=1000;

      cin>>x>>y>>x1>>y1;
      if(x1-x!=0)
        b=(y1-y)/(x1-x);
      else
        b=1000;

      if(a==b)
        puts("YES");
      else
        puts("NO");
    }

}

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

//#define PI 3.141592653589

using namespace std;



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

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){
		float x[4];
		float y[4];
		float ans[2];
		rep(i,4)cin>>x[i]>>y[i];
		rep(i,2)ans[i] = (x[i+2] - x[i]) * (y[i+2]-y[i]);
		if(ans[0]==ans[1])cout<<"YES";
		else cout<<"NO";
		cout<<endl;
	}
}

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 <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define int long long
using namespace std;
typedef pair<int, int> P;

const int INF = 1e8;
const double EPS = 1e-10;

signed main(){
    int n;
    cin >> n;
    double x[4], y[4];
    rep(i, 0, n){
        rep(j, 0, 4){
            cin >> x[j] >> y[j];
        }
        double h1, h2;
        if(fabs(x[1] - x[0] < EPS)) h1 = INF;
        else h1 = (y[1] - y[0]) / (x[1] - x[0]);
        if(fabs(x[3] - x[2]) < EPS) h2 = INF;
        else h2 = (y[3] - y[2]) / (x[3] - x[2]);
        if(fabs(h1 - h2) < EPS) cout << "YES" << endl;
        else cout << "NO" << endl;
    }
}

C++: #include<iostream>
#include<vector>
#include<algorithm>
#include<map>
#include<string>
#include<cmath>
#include<numeric>
using namespace std;


int main(void) {

  int n;
  cin >> n;
  for(int i=0; i<n; i++){
    double x1, y1, x2, y2;
    double x3, y3, x4, 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<cstdio>
#include<cmath>
#include<iostream>
#include<algorithm>
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(fabs((y2-y1)/(x2-x1)-(y4-y3)/(x4-x3))<0.0000000000001)cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
	}
	return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <deque>
#include <list>
#include <string>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>

using namespace std;

int n;
double x1,x2,x3,x4,ya1,y2,y3,y4;

int main() {
	cin >> n;

	for (int i = 0; i < n; i++) {
		cin >> x1 >> ya1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		if (x1 > x2) {
			double tmp = x1;
			x1 = x2;
			x2 = tmp;
			tmp = ya1;
			ya1 = y2;
			y2 = tmp;
		}
		if (x3 > x4) {
			double tmp = x3;
			x3 = x4;
			x4 = tmp;
			tmp = y3;
			y3 = y4;
			y4 = tmp;
		}

		if (x1 == x2) {
			if (x3 == x4) cout << "YES" << endl;
			else cout << "NO" << endl;
		} else {
			if (x3 == x4) cout << "NO" << endl;
			else {
				if ((y2 - ya1) / (x2 - x1) - (y4 - y3) / (x4 - x3) <= 0.00000000001)
					cout << "YES" << endl;
				else cout << "NO" << endl;
			}
		}
	}

	return 0;
}

/*@@@@@@@@@@@@@@@@@@@@@@@@@*/
/*@                       @*/
/*@ debug output erased ? @*/
/*@                       @*/
/*@@@@@@@@@@@@@@@@@@@@@@@@@*/

C++: #include<iostream>
using namespace std;
#define dff 1e-9
int main(){
  int n;
  cin >>n;
  while(n--){
    double a[4][2],x;
    for(int i=0; i<4; i++) for(int j=0; j<2; j++) cin >>a[i][j];
    for(int i=0; i<2; i++) for(int j=0; j<2; j++) a[i*2][j]-=a[i*2+1][j];
    x = a[0][0]*a[2][1]-a[0][1]*a[2][0];
    if(-dff<x && x<dff) cout <<"YES"<<endl;
    else cout <<"NO"<<endl;
  }
  return 0;
}

C++: #include<iostream>
#include<queue>
#include<string>
#include<stack>
#include<cstdio>
#include<algorithm>

using namespace std;

int main(void)
{
  double x,y,x2,y2;
  double x1,y1,x3,y3;
  int n;
  int i;
  long double a=0,b=0;
  int k=0;
  int j=0;

  cin>>n;

  for(i=0;i<n;i++)
    {
      cin>>x>>y>>x1>>y1;
      cin>>x2>>y2>>x3>>y3;

      a=(y1-y)*(x3-x2);
      j++;

      b=(y3-y2)*(x1-x);
      j++;


      if(a==b || ((x1-x)==0 && (x3-x2)==0) || ((y1-y)==0 && (y3-y2)==0))
        puts("YES");
      else
        puts("NO");
    }

}

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

int main()
{
    float a,s,d,f,g,h,j,k;
    float 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;
        float key=q*r-w*e;
        if(!key)cout<<"YES"<<endl;
        else  cout<<"NO"<<endl;
    }
    return 0;
}

C++: #include <stdio.h>
int main(void)
{
	int i,n;
	scanf("%d",&n);
	double x1[100],y1[100],x2[100],y2[100],x3[100],y3[100],x4[100],y4[100];
	for(i=0;i<n;i++){
		scanf("%lf %lf %lf %lf %lf %lf %lf %lf",&x1[i],&y1[i],&x2[i],&y2[i],&x3[i],&y3[i],&x4[i],&y4[i]);
	}
	double a[100],b[100];
	for(i=0;i<n;i++){
		a[i]=(y2[i]-y1[i])/(x2[i]-x1[i]);
		b[i]=(y4[i]-y3[i])/(x4[i]-x3[i]);
		if(a[i]==b[i]){
			puts("YES");
		}
		else{
			puts("NO");
		}
	}
	return 0;
}