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++: //0021 Parallelism

//x1,y1,x2,y2,x3,y3,x4,y4ª^¦çê½Æ«A_1,2ðÊé§íÆ_3,4ðÊé¼üª½s©»èµÈ³¢
//È¨A_ÌÀWÍ»ê¼ê|100Èã100ÈºÌÀÆ·é


#include<iostream>
#include<cmath>
using namespace std;

struct Point
{
	Point(){}
	Point(double x, double y):x(x),y(y){}
	double x, y;
	const Point operator -(const Point &rhv){return Point(x-rhv.x, y-rhv.y);}
};

bool NearEqual(double x, double y)
{
	const double EPS = 0.001;
	return (abs(x-y) < EPS);
}

int main(void)
{
	int n;
	int i;
	const int N = 4;
	Point p[N];

	cin >> n;
	while(n--)
	{
		for(i = 0; i < N; i++)
			cin >> p[i].x >> p[i].y;

		//ñ_ðÊé¼üÌX«ðßé©
		Point v[N/2];
		double a[N/2];

		for(i = 0; i < N/2; i++)
		{
			v[i] = p[i*2]-p[i*2+1];
		}
		//àµàÇ¿ç©Ìx¬ªª0ÈçA¼ûÆà0Èç½s
		bool nearZero[N/2] = {NearEqual(v[0].x, 0), NearEqual(v[1].x, 0)};
		if( nearZero[0] || nearZero[1] )
		{
			if( nearZero[0] && nearZero[1])
				cout << "YES" << endl;
			else
				cout << "NO" << endl;
		}
		//Ç¿çàx¬ªª0ÅÈ¯êÎAX«ðæÁÄä×é
		else
		{
			a[0] = v[0].y / v[0].x;
			a[1] = v[1].y / v[1].x;
			//åÌ¯¶Èç½s
			if(NearEqual(a[0], a[1]))
				cout << "YES" << endl;
			else
				cout << "NO" << endl;
		}

		/*
		//2ÂÌ_ÌÊuxNgÌ·ðæé
		Point v1(p[0].x-p[1].x, p[0].y-p[1].y),
			v2(p[2].x-p[3].x, p[2].y-p[3].y);

		//KÉë·àe
		if( abs(v1.x*v2.y - v1.y*v2.x) < 0.01)
			cout << "YES" << endl;
		else
			cout << "NO" << endl;
			*/
	}
	return 0;
}

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

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

int main(){
    double EPS = 1e-8;
    double x[4];
    double y[4];
    double s;
    double t;
    double u;
    double v;
    int n;
    cin >> n;

    for (int t = 0;t < n;++t) {
        for (int i = 0;i < 4;++i){
            cin >> x[i] >> y[i]; 
        }
    }
    s = x[1] - x[0];
    t = y[1] - y[0];
    u = x[3] - x[2];
    v = y[3] - y[2];

    if(s * v - t * u > 0){
        double m = s * v - t * u;
    }
    else{
        double m = t * u - s * v;
    }

    if( m < EPS){
//        cout << "YES" << endl;
    }
//    else{
//        cout << "NO" << endl;
//    }
//    return 0;


    cout << "NO" << endl;
}

C++: #include<iostream>
#include<cmath>
using namespace std;
int main(){
	int n;
	cin >> n;
	while(n--){
		double x[4], y[4], p1 ,p2;
		for(int i = 0; i < 4; i++) cin >> x[i] >> y[i];
		p1 = (y[1] - y[0]) / (x[1] - x[0]);
		p2 = (y[3] - y[2]) / (x[3] - x[2]);
		if(abs(p1 - p2) < 1e-5) cout << "YES" << endl;
		else cout << "NO" << endl;	
	}
}

C++: #include<cmath>
#include<iostream>
#include<algorithm>
#include<iomanip>
#include<vector>
#include<string>
#include<queue>
#include<stack>
#include<cstdio>
#include<map>
#define rep(i,n) for(int i=0;i<n;i++)
#define fori(i,k,n) for(int i=k;i<n;i++)
using namespace std;
const int dx[4] = { 0, 1, 0, -1 }, dy[4] = { 1, 0, -1, 0 };
const int dX[8] = { 0, 1, 1, 1, 0, -1, -1, -1 }, dY[8] = { 1, 1, 0, -1, -1, -1, 0, 1 };
/*
(char)'1' - (int)48 = (int)1; 


*/


int main()
{
	int n;
	cin >> n;
	while (n--){
		double x[4], y[4];
		rep(i, 4)cin >> x[i]>>y[i];
		rep(i, 4)
		{
			x[i] += 3.51;
			y[i] += 3.51;;

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

	}
	return 0;

}

C++: #include <stdio.h>

int main(){
    int n,i,j;
    double x[5],y[5];
    long X[5],Y[5];
    scanf("%d",&n);
    for(i=0;i<n;i++){
        for(j=1;j<=4;j++){
            scanf("%lf %lf",&x[i],&y[i]);
            X[i] = (long)(x[i]*100000);
            Y[i] = (long)(y[i]*100000);
        }
        if((X[2]-X[1])*(Y[4]-Y[3])-(X[4]-X[3])*(Y[2]-Y[1])){
            printf("NO\n");
        }else{
            printf("YES\n");
        }
    }
}

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 <math.h>

using namespace std;

int main(void){
	int n, i;
	double x1, y1, x2, y2, x3, y3, x4, y4;
	double dega, degb;

	cin >> n;

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

		dega = (y2 - y1) / (x2 - x1);
		degb = (y4 - y3) / (x4 - x3);
	
		if(fabs(dega - degb) < 1.0e-10){
			cout << "YES" << endl;
		}else{
			cout << "NO" << endl;
		}
	}

	return 0;
}

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

using namespace std;

int main()
{
	int i,num;
	float x[4],y[4];
	cin >> num;

	for ( i = 0 ; i< num; i++ ) {
		cin >> x[0] >> y[0] >> x[1] >> y[1] >> x[2] >> y[2] >> x[3] >> y[3];

		if( fabs( (x[0]-x[1])*(y[2]-y[3]) - (y[0]-y[1])*(x[2]-x[3]) ) < 1e-10 ){
			cout << "YES" << endl;
		}
		else{
			cout << "NO" << endl;
		}
	}
	return 0;
}

C++: #include <iostream>

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

	for (int i = 0; i < n; i++) {
		std::cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		if ((y2 - y1) / (x2 - x1) == (y4 - y3) / (x4 - x3)) {
			std::cout << "YES" << std::endl;
		}
		else {
			std::cout << "NO" << std::endl;
		}
	}





}

C++: #include <stdio.h>
#include <math.h>

const double eps = 1e-10;

int n;
//math.hライブラリでy1, y2...とかって変数名が使われてるらしい
double ix1, ix2, ix3, ix4;
double iy1, iy2, iy3, iy4;

//増加率を見る方法
int solve1() {
    double r1 = (iy2-y1)/(ix2-ix1);
    double r2 = (iy4-y3)/(ix4-ix3);
    return (fabs(r1-r2) < eps)
}

int main() {
    scanf("%d", &n);
    for(int i=0; i<n; ++i) {
        scanf("%lf %lf %lf %lf %lf %lf %lf %lf", &ix1, &iy1, &ix2, &iy2, &ix3, &iy3, &ix4, &iy4);

        if(solve1()) {
            printf("YES\n");
        } else {
            printf("NO\n");
        }
    }
}

C++: #include <iostream>
using namespace std;
int main()
{
	double x[4], y[4];
	int n;
	cin >> n;
	while (n--) {
		for (int i = 0; i < 4; ++i) cin >> x[i] >> y[i];
		double A1 = y[1] - y[0];
		double B1 = x[0] - x[1];
		double C1 = A1 * x[0] + B1 * y[0];
		double A2 = y[3] - y[2];
		double B2 = x[2] - x[3];
		double C2 = A1 * x[2] + B1 * y[2];
		if (A1 * B2 - A2 * B1 == 0)
			cout << "YES";
		else
			cout << "NO";
		cout << endl;
	}
	return 0;
}