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++: #include <bits/stdc++.h>
using namespace std;

int main()
{
  int n;
  cin >> n;
  while (n--){
    double x[4], y[4];
    bool f = false;
    for (int i = 0; i < 4; i++) cin >> x[i] >> y[i];
    if (x[0] - x[1] == x[2] - x[3] && y[0] - y[1] == y[2] - y[3]){
      f = true;
    }

    if (f){
      cout << "YES\n";
    }
    else {
      cout << "NO\n";
    }
  }
}

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(same(a1,a2))cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
	}
	
	return 0;
}

C++: #define _USE_MATH_DEFINES
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<cctype>
#include<cmath>
#include<cstdio>
#include<deque>
#include<list>
#include<set>
#include<stack>
#include<string>
#include<sstream>
#include<map>
#include<queue>
#include<vector>
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 ABx = x2 - x1,
			ABy = y2 - y1,
			CDx = x4 - x3,
			CDy = y4 - y3;
		if (ABy&&CDy)
			if (ABx / ABy == CDx / CDy)
				cout << "YES" << endl;
			else
				cout << "NO" << endl;
		else if (ABx&&CDx)
			if (ABy / ABx == CDy / CDx)
				cout << "YES" << endl;
			else
				cout << "NO" << endl;
		else
			cout << "NO" << endl;
	}
	return 0;
}

C++: #include <iostream>
using namespace std;
int main(){
    int n;
    cin >> n;
    double x1,x2,x3,x4,y1,y2,y3,y4;
    for(int i=0;i<n;i++){
        cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
        if (x2==x1 && x4==x3)
            cout << "YES" << endl;
        else
            if(x2==x1 || x4==x3)
                cout << "NO" << endl;
            else
                if((y2-y1)/(x2-x1)==(y4-y3)/(x4-x3))
                    cout << "YES" << endl;
                else
                    cout << "NO" << endl;
    }

}

C++: #include <iostream>

using namespace std;


int main(int argc, char *argv[]){
	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 s1=(y2-y1)/(x2-x1), s2=(y4-y3)/(x4-x3);
		if(s1==s2) cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
	}

    return 0;
}

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

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( x1 - x2 == 0 ){
			tan1 = INF;
		}else{
			tan1 = (y1-y2) / (x1-x2);//max((x1-x2), -1*(x1-x2));
		}
		if( x3 - x4 == 0 ){
			tan2 = INF;
		}else{
			tan2 = (y3-y4) / (x3-x4);//max((x3-x4), -1*(x3-x4));
		}
		if( tan1 == tan2 ) cout << "YES" << endl;
		else cout << "NO" << endl;
	}
}

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

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

C++: #include <bits/stdc++.h>
using namespace std;
const double eps = 1e-7;

int main() {
    cout << eps << endl;
    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 << (fabs((x2-x1)*(y4-y3) - (x4-x3)*(y2-y1)) < eps ? "YES" : "NO") << endl;
    }
    return 0;
}

C++: #include "bits/stdc++.h"

#define REP(i, n) for(decltype(n) i = 0; i < (n); i++)
#define REP2(i, x, n) for(decltype(x) i = (x); i < (n); i++)
#define RREP(i, n) for (decltype(n) i = (n) - 1;i >= 0; i--)

#define ALL(a) (a).begin(),(a).end()
#define SORT(c) sort((c).begin(),(c).end())
#define DESCSORT(c) sort(c.begin(), c.end(), greater<int>())

#define LL long long int
#define LD long double

#define PI 3.14159265358979

#define _CRT_SECURE_NO_WARNINGS

using namespace std;

//================================================
bool func(vector<double>x, vector<double>y) {
	double A = (y[1] - y[0]) / (x[1] - x[0]);
	double B = (y[3] - y[2]) / (x[3] - x[2]);

	if (A == B) return true;
	else return false;	
}


int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);

	int num;
	cin >> num;

	REP(i, num) {
		vector<double>x(4);
		vector<double>y(4);

		REP(i, 4) cin >> x[i] >> y[i];
		cout << (func(x, y) ? "YES" : "NO") << "\n";
	}
	return 0;
}

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

#define EPS (1e-10)
#define EQ(a,b) (abs((a)-(b)) < EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )

using namespace std;
typedef complex<double> P;
// OÏ (cross product) : a~b = |a||b|sin¦
double cross(P a, P b) {
  return (a.real() * b.imag() - a.imag() * b.real());
}
int main(){
  double x1,y1,x2,y2,x3,y3,x4,y4;
  int n;
  P a,b;
  for(cin>>n;n>0;n--){
    cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
    a = P(x2-x1,y2-y1);
    b = P(x4-x3,y4-y3);
    if EQ(cross(a,b),0.0)
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }
  return 0;
}

C++: #include <iostream>
using namespace std;
int main() {
  int n;
  double x1, y1, x2, y2, x3, y3, x4, y4, a, b, c, d;
  cin >> n;
  while (n--) {
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
    a = x2 - x1;
    b = x4 - x3;
    c = y2 - y1;
    d = y4 - y3;
    if ((a == 0 && b == 0) || c / a == d / b) {
      cout << "YES" << endl;
    } else {
      cout << "NO" << endl;
    }
  }
  return 0;
}

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

using namespace std;
#define eps 1e-10

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

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