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[4] == fpoints[6] {
			fmt.Println("YES")
		} else {
			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>
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];

	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 <bits/stdc++.h>
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;
        cout << (abs((x2-x1)*(y4-y3) - (x4-x3)*(y2-y1)) < eps ? "YES" : "NO") << endl;
    }
    return 0;
}

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

int main(){
	int t;
	double x1, y1, x2, y2, x3, y3, x4, y4;
	scanf("%d", &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);
		//printf("%f\n%f\n", (x2 - x1) * (y4 - y3), (x4 - x3) * (y2 - y1));
		if((double)(x2 - x1) * (y4 - y3) == (double)(x4 - x3) * (y2 - y1))printf("YES\n");
		else printf("NO\n");
	}
	return 0;
}

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

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

	for (; n--;){
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		
		double a, b;

		a = (y2 - y1) / (x2 - x1);
		b = (y4 - y3) / (x4 - x3);


		if (a==b)
			cout << "YES" << endl;
		else
			cout << "NO" << endl;
		
	}
	return 0;
}

C++: #include<iostream>
using namespace std;
int main()
{
	int n;cin>>n;
	for(;n--;)
	{
		double a,b,c,d,e,f,g,h;cin>>a>>b>>c>>d>>e>>f>>g>>h;
		if(c-a==0||g-e==0)
		{
			cout<<(c-a==g-e?"YES":"NO")<<endl;
		}
		else
		{
			cout<<((d-b)*(g-e)==(h-f)*(c-a)?"YES":"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((y2 - y1) / (x2 - x1) == (y4 - y3) / (x4 - x3)) cout << "YES" << endl;
		else cout << "NO" << endl;
	}
	return 0;
}

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

void hantei(double x[], double y[]);

int main() {
  int n;
  double x[4], y[4];
  scanf("%d", &n);
  for(int i=0;i<n;i++) {
    for(int j=0;j<4;j++) scanf("%lf %lf", &x[j], &y[j]);
    hantei(x, y);
  }
}

void hantei(double x[], double y[]) {
  if(x[0]==x[1]) {
    if(x[2]==x[3])printf("YES\n");
    else printf("NO\n");
  } else if(x[2]==x[3])printf("NO\n");
  else {
    if((y[1]-y[0])/(x[1]-x[0])==(y[3]-y[2])/(x[3]-x[2]))
      printf("YES\n");
    else printf("NO\n");
  }
  /*
    if(x[0]==x[1]) {
    if(x[2]==x[3]) return true;
    else return false;
    } else if(x[2]==x[3]) return false;
    else {
    if(x[1]-x[0]/y[1]-y[0] == x[3]-x[2]/y[3]-y[2]) return true;
    else  return false;
    }
  */
}

C++: #include<bits/stdc++.h>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
using namespace std;

struct vec{
	double x;
	double y;
};

int main(){
	int n;
	while(cin>>n){
		double x[4],y[4];//0:A 1:B 2:C 3:D
		rep(i,n){
			rep(j,4)cin>>x[j]>>y[j];
			vec ABvec;
			vec CDvec;
			ABvec.x=x[1]-x[0];
			ABvec.y=y[1]-y[0];
			CDvec.x=x[3]-x[2];
			CDvec.y=y[3]-y[2];
			double elmeet=abs(ABvec.x*CDvec.x+ABvec.y*CDvec.y);
			double ABnolme=sqrt(pow(ABvec.x,2)+pow(ABvec.y,2));
			double CDnolme=sqrt(pow(CDvec.x,2)+pow(CDvec.y,2));
			if(abs(ABnolme*CDnolme-elmeet)<10e-10)cout<<"YES"<<endl;
			else cout<<"NO"<<endl;
		}
	}
	return 0;
}

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

int main()
{
  double x1, x2, x3, x4, y1, y2, y3, 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<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 <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <functional>

using namespace std;

int main()
{
	int n;
	double ax, ay, bx, by, cx, cy, dx, dy;

	cin >> n;

	for ( int i = 0; i < n; i++ )
	{
		cin >> ax >> ay >> bx >> by >> cx >> cy >> dx >> dy;
		if ( ( by - ay ) / ( bx - ax ) == ( dy - cy ) / ( dx - cx ) )
		{
			cout << "YES";
		}
		else
		{
			cout << "NO";
		}
		cout << endl;
	}

	return 0;
}

C++: #include<stdio.h>

int main(void)
{
	double x[4]={0},y[4]={0},x1,x2,y1,y2;
	int i;
	scanf("%d",&i);//繰り返す回数の入力

	while(i!=0)
	{
		scanf("%f %f %f %f %f %f %f %f",&x[0],&y[0],&x[1],&y[1],&x[2],&y[2],&x[3],&y[3]);//入力した数の読み込み
		x1 = x[2]-x[1];   y1 = y[2]-y[1];//傾きを求めるのに必要な数を求める
		x2 = x[4]-x[3];   y2 = y[4]-y[3];
		if(x1==0 && x2==0)//傾き0のときは０で割ることができないため
			printf("YES\n");
		else if((x1==0 && x2!=0) ||(x1!=0&& x2==0))//片方が傾き0のとき
			printf("NO\n");
		else if(y1/x1 == y2/x2)//傾きが等しい＝平衡
			printf("YES\n");
		else //傾きが等しくない＝平衡ではない
			printf("NO\n");

		i-=1;
	}
 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_ *1000000LL + 1e-9;
                y[i][j] = y_ *1000000LL + 1e-9;
            }
        }
        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");
    }
}