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 <cstdio>
#include <cstring>
#include <algorithm>
#include <string>
#include <cmath>
#include <stack>
#include <vector>
#include <iostream>


using namespace std;

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

		double x1 = x[1] - x[0];
		double y1 = y[1] - y[0];
		double x2 = x[3] - x[2];
		double y2 = y[3] - y[2];
		if (abs(x1) < 0.001 && abs(x2) < 0.001
			|| abs(y1/x1-y2/x2) < 0.001)
			puts("YES");
		else
			puts("NO");
	}

	return 0;
}

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

int main() {

  int n;
  cin >> n;

  for ( int i = 0; i < n; i++ ) {

    double x[4],y[4];
    cin >> x[0] >> y[0] >> x[1] >> y[1] >> x[2] >> y[2] >> x[3] >> y[3];

    if ( ( x[0] - x[1] ) * ( x[2] - x[3] ) == 0 ) {

      if ( x[0] == x[1] && x[2] == x[3] ) {
	cout << "YES" << endl;
      }else {
	cout << "NO" << endl;
      }

    }else {

      long long int t1 = ( y[1] - y[0] ) * 1000000 / ( x[1] - x[0] );
      long long int t2 = ( y[3] - y[2] ) * 1000000 / ( x[3] - x[2] );

      if ( t1 == t2 ) {
	cout << "YES" << endl;
      }else {
	cout << "NO" << endl;
      }

    }

  }

  return 0;

}

C++: #include <stdio.h>
#define EPSIRON (1.0e-30)

int main(void){
    int n;
    double x1, x2, x3, x4, dx1, dx2;
    double y1, y2, y3, y4, dy1, dy2;
    double cp; // cross product
    
    scanf("%d", &n);
    for (int i=0; i<n; i++){
        scanf("%lf %lf %lf %lf", &x1, &y1, &x2, &y2);
        scanf("%lf %lf %lf %lf", &x3, &y3, &x4, &y4);
        dx1 = x2 - x1;
        dy1 = y2 - y1;
        dx2 = x4 - x3;
        dy2 = y4 - y3;
        cp = dx1 * dy2 - dy1 * dx2;
        printf("%s\n", cp*cp < EPSIRON ? "YES" : "NO");
    }
    
    return 0;
}

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

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

	int n;
	cin >> n;

	while(n > 0){
		double x[4];
		double y[4];

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

		double m1 = (y[0] - y[1]) / (x[0] - x[1]);
		double m2 = (y[2] - y[3]) / (x[2] - x[3]);

		cout << (m1 == m2 ? "YES" : "NO") << endl;

		--n;
	}

	return 0;
}

C++: #include <stdio.h>

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

	scanf("%d", &n);

	for (int i = 0; i < n; i++){
		scanf("%lf %lf %lf %lf %lf %lf %lf %lf", &x[0], &y[0], &x[1], &y[1], &x[2], &y[2], &x[3], &y[3]);

		if((x[1]-x[0])*(y[3]-y[2]) == (y[1]-y[0])*(x[3]-x[2])) puts("YES");
		else puts("NO");
	}

	return 0;
}

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

int main()
{
	int n;
	cin>>n;
	complex<double> a,b,c,d;
	while(n--)
	{
		cin>>a.real()>>a.imag()>>b.real()>>b.imag()>>c.real()>>c.imag()>>d.real()>>d.imag();
		a=a-b;
		c=c-d;

		cout<<(a.real()*c.imag()-a.imag()*c.real()==0?"YES":"NO")<<endl;
	}
	return 0;
}

C++: #define scanf_s scanf
//#define gets_s gets
#include <stdio.h>
#include <string>
#include <iostream>
#include <math.h>
using namespace std;
#define MAX 201
#define _MAX 100
#define ABC 26
int main(void)
{
	int n;
	double x1, y1, x2, y2, x3, y3, x4, y4, a1, b1, a2, b2;
	scanf_s("%d", &n);
	for (int i = 0; i < n; ++i) {
		scanf_s("%lf %lf %lf %lf %lf %lf %lf %lf", &x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4);
		if ((y1 - y2) / (x1 - x2) == (y3 - y4) / (x3 - x4))
			printf("YES\n");
		else
			printf("NO\n");
	}
}

C++: #include <iostream>
#include <cmath>
using namespace std;
const double eps = 1e-9;
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;
        x1 *= 100000;
        y1 *= 100000;
        x3 *= 100000;
        y3 *= 100000;
        x1 -= x2 * 100000;
        y1 -= y2 * 100000;
        x3 -= x4 * 100000;
        y3 -= y4 * 100000;
        cout << (abs(x1 * y3 - y1 * x3) < eps ? "YES" : "NO") << endl;
    }
    return 0;
}

C++: #include<iostream>
#include<cmath>
using namespace std;
int main(){
  double a[2],b[2],c[2],d[2];
  int n;
  cin >> n;
  for(int i=0;i<n;i++){
    for(int j=0;j<2;j++) cin >> a[j] >> b[j] >> c[j] >> d[j];
    if(a[0]-b[0]==0&&c[0]-d[0]==0) cout << "YES" << endl;
    else if(a[1]-b[1]==0&&c[1]-d[0]==0) cout << "YES" << endl;
    else if(a[0]*d[0]+a[1]*b[1]==b[0]*d[0]+b[1]*d[1]) cout << "YES" << endl;
    else cout << "NO" << endl;
  }   
  return 0;
}

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

int main() {
	int n;
	double x1, x2, x3, x4, y1, y2, y3, y4;
	vector<double> X1, Y1, X2, Y2;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		X1.push_back(x2 - x1); Y1.push_back(y2 - y1);
		X2.push_back(x4 - x3); Y2.push_back(y4 - y3);
	}
	for (int i = 0; i < n; i++) {
		if (fabs(X1[i]*Y2[i]-X2[i]*Y1[i]<1e-10))cout << "YES" << endl;
		else cout << "NO" << endl;
	}
	return 0;
}

C++: #include<algorithm>
#include<vector>
#include<cassert>
#include<string>

using namespace std;

long long N, X[4], Y[4];

string parallel_judge(){
	if ((X[1] * 100000 - X[0] * 100000)*(Y[3] * 100000 - Y[2] * 100000) == (Y[1] * 100000 - Y[0] * 100000)*(X[3] * 100000 - X[2] * 100000)){
		return "YES";
	}
	else{
		return "NO";
	}
}

int main()
{
	cin >> N;
	for (int i = 0; i < N; i++){
		for (int j = 0; j < 4; j++){
			cin >> X[j] >> Y[j];
		}
		cout << parallel_judge() << endl;
	}
}

C++: #include <stdio.h>

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

	scanf("%d", &n);

	for (int i = 0; i < n; i++){
		scanf("%lf %lf %lf %lf %lf %lf %lf %lf", &x[0], &y[0], &x[1], &y[1], &x[2], &y[2], &x[3], &y[3]);

		if((x[1]-x[0])*(y[3]-y[2]) == (y[1]-y[0])*(x[3]-x[2])) printf("YES\n");
		else printf("NO\n");
	}

	return 0;
}

C++: //
#include <iostream>
#include <cstdio>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <array>
#include <numeric>
#include <functional>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<utility>
#include<complex>

using namespace std;

#define REP(i,m,n) for(int i=m;i<(n);i++)
#define rep(i,n) REP(i,0,n)
#define ALL(x) (x).begin(),(x).end()

typedef long long ll;
typedef pair<int, int> pii;

// const ll inf = INT_MAX;
const double eps = 1e-5;
const double pi = acos(-1.0);
const int di[][2] = {{1,0},{0,1},{-1,0},{0,-1},{1,1},{1,-1},{-1,1},{-1,-1}};

int main(){
	int n;
	scanf("%d\n", &n);
	double x[4], y[4];
	rep(i,n){
		rep(j,4){
			scanf("%lf %lf", &x[j], &y[j]);
		}
		double dx[2], dy[2];
		dx[0] = x[1] - x[0];
		dx[1] = x[3] - x[2];
		dy[0] = y[1] - y[0];
		dy[1] = y[3] - y[2];
		if(std::abs(dy[1]*dx[0] - dy[0]*dx[1]) < eps) printf("YES\n");
		else printf("NO\n");
	}
	return 0;
}