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 <bits/stdc++.h>
#define rep(i,l,n) for(int i=l;i<n;i++)
using namespace std;


typedef complex<double> xy_t;

double cross_product(xy_t a,xy_t b){
	return (conj(a)*b).imag();
}
const double eps=1e-11;
double x[4],y[4];
int n;

int main(){
	cin>>n;
	rep(i,0,n){
		rep(j,0,4){
			cin>>x[j]>>y[j];
		}
		xy_t a[2]={xy_t(x[0],y[0])-xy_t(x[1],y[1]),xy_t(x[2],y[2])-xy_t(x[3],y[3])};
		bool p=abs(cross_product(a[0],a[1]))<eps;
		cout<<(p?"YES":"NO")<<endl;
	}
}

C++: #include <iostream>
#include <math.h>
using namespace std;
int main()
{
	int n;
	cin >> n;
	double x1, y1, x2, y2, x3, y3, x4, y4;
	double eps = 0.0000000001;
	while (n--){
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		double s1 = x2 - x1,
			   t1 = y2 - y1,
			   s2 = x4 - x3,
			   t2 = y4 - y3;
		double v = fabs(s1 * t2 - s2 * t1);
		if (v < eps) cout << "YES\n";
		else         cout << "NO\n";
	}
	return 0;
}

C++: #include <complex>
#include <iostream>
#define _USE_MATH_DEFINES
#include <cmath>
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;
    complex<double> c1(x1, y1);
    complex<double> c2(x2, y2);
    complex<double> c3(x3, y3);
    complex<double> c4(x4, y4);
    double a = arg(c2 - c1) - arg(c4 - c3);
    cout << ((a == 0 || a == M_PI || a == -M_PI) ? "YES" : "NO") << endl;
  }
}

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

using namespace std;

typedef complex<double> P;
struct L : public vector<P> {
    L(const P &a, const P &b) {
        push_back(a);
        push_back(b);
    }
};

const double EPS = 1e-10;

double cross(P a, P b)
{
    return imag(conj(a) * b);
}

bool intersectLL(const L &l, const L &m)
{
    return fabs(cross(l[1]-l[0], m[1]-m[0])) > EPS;
}

int main()
{
    int n;

    scanf("%d", &n);
    for (int i = 0; i < n; ++i) {
        P p[4];
        double x, y;

        scanf("%lf %lf", &x, &y);
        p[0] = P(x, y);
        scanf("%lf %lf", &x, &y);
        p[1] = P(x, y);
        scanf("%lf %lf", &x, &y);
        p[2] = P(x, y);
        scanf("%lf %lf", &x, &y);
        p[3] = P(x, y);

        puts(intersectLL(L(p[0], p[1]), L(p[2], p[3])) ? "NO" : "YES");
    }

    return 0;
}

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

double EPS = 1e-17;
// BEGIN //////////////////////////////////////////////////////////////
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);
	 	double s = x1 - x2, t = y1 - y2, u = x3 - x4, v = y3 - y4;
	 	if (s * v == t * u) {
		 	printf("YES\n");
	 	} else {
		 	printf("NO\n");
	 }
	}

	return 0;
}

// END   //////////////////////////////////////////////////////////////

C++: #include <cstdio>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string.h>
#include <queue>
#include <stack>
#include <utility>
#include <queue>
#include <cmath>
#define mp make_pair
#define pii pair<int,int> 
#define ff first
#define ss second

using namespace std;

double x[10],y[10];
double g1,g2;
int tc;

int main()
{
	scanf("%d",&tc);
	while(tc--)
	{
		scanf("%lf %lf %lf %lf %lf %lf %lf %lf",&x[1],&y[1],&x[2],&y[2],&x[3],&y[3],&x[4],&y[4]);
		g1=(y[2]-y[1])/(x[2]-x[1]);
		g2=(y[4]-y[3])/(x[4]-x[3]);
		if(g1==g2)
		{
			printf("YES\n");
		}
		else
		{
			printf("NO\n");
		}
		//printf("%.2lf,%.2lf\n",g1,g2);
	}
	return 0;
}

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

#define EPS 0.0000001

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;
      if(abs((y2-y1)/(x4-x3)-(y4-y3)/(x2-x1)) <EPS )cout << "YES" << endl;
      else cout << "NO" << endl;
    }


  return 0;
}

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

int main()
{
	int n;
	double x[4], y[4];

	while (cin >> n, n){
		for (int i = 0; i < 4; i++){
			cin >> x[i] >> y[i];
		}

		double abx = fabs(x[0] - x[1]), cdx = fabs(x[2] - x[3]);
		double aby = y[0] - y[1], cdy = y[2] - y[3];

		if (aby / abx == cdy / cdx){
		   cout << "YES" << endl;
		}

		else {
			cout << "NO" << endl;
		}
	}
	return (0);
}

C++: #include <cassert>
#include <cmath>
#include <iostream>
#include <vector>
#include <iomanip>

struct Point
{
    float x;
    float y;
};
struct Line
{
    Line(const Point& a, const Point& b)
    : p1(a), p2(b) {}
    Point p1;
    Point p2;
};
double GetSlope(const Line& line)
{
    return
    (line.p2.y - line.p1.y) /
    (line.p2.x - line.p1.x);
}
bool IsParallel(const Line& l1, const Line&l2)
{
    // std::cerr << std::fixed << std::setprecision(100) << GetSlope(l1) << std::endl;
    // std::cerr << std::fixed << std::setprecision(100) << GetSlope(l2) << std::endl;
    // return GetSlope(l1) == GetSlope(l2);
    const double gosa = 0;
    double Slope1 = GetSlope(l1);
    double Slope2 = GetSlope(l2);
    return std::fabs(Slope1 - Slope2) <= gosa;
}
bool IsParallel(const std::vector<Point>& points)
{
    assert(points.size() == 4);
    return IsParallel(Line(points[0], points[1]), Line(points[2], points[3]));
}
std::vector<Point> Input(std::istream& is)
{
    std::vector<Point> points(4);
    for(int i = 0; i < points.size(); ++i){
        is >> points[i].x >> points[i].y;
    }
    return points;
}
int main()
{
    int n;
    std::cin >> n;
    for(int i = 0; i < n; ++i) {
        std::vector<Point> p = Input(std::cin);
        std::cout << (IsParallel(p) ? "YES" : "NO") << std::endl; 
        // if((p[1].y-p[0].y)/(p[1].x-p[0].x) == (p[3].y-p[2].y)/(p[3].x-p[2].x)){
        //     std::cout << "YES";
        // }else{
        //     std::cout << "NO";
        // }
        // std::cout << std::endl;
    }
    return 0;
}

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

using namespace std;
#define eps 1e-9

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(fabs(x[1] - x[0]) < eps && fabs(x[3] - x[2]) < eps)
		{
			cout << "YES" << endl;
		}
		else if(fabs(x[1] - x[0]) < eps || fabs(x[3] - x[2]) < eps)
		{
			cout << "NO" << endl;
		}
		else if(fabs((y[1] - y[0]) / (x[1] - x[0]) - (y[3] - y[2]) / (x[3] - x[2])) < eps)
		{
			cout << "YES" << endl;
		}
		else
		{
			cout << "NO" << endl;
		}
	}
}

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