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<iostream>
#include<cmath>
using namespace std;

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

    cin >> n;

    //a(x1,y1) b(x2,y2) c(x3,y3) d(x4,y4)
    for( int i = 0; i < n; i++ )
    {   
        cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;

        double px, py, qx, qy;
        px = x2 - x1;
        py = y2 - y1;
        qx = x4 - x3;
        qy = y4 - y3;

        if( fabs( px * qy - py * qx ) < 1e-10 )
            cout << "YES" << endl;
        else
            cout << "NO" << endl;
    }
    return 0;
}

C++: #include <iostream>
#include <string>
using namespace std;
 
int main()
{
    int n;
    cin >> n;
    for (int i = 0 ; i < n ; i++)
    {
        long double x[4],y[4],s,t;
        cin >> x[0] >>y[0] >>x[1] >>y[1] >>x[2] >>y[2] >>x[3] >>y[3];
        s = (y[1]-y[0])*(x[3]-x[2]);
        t = (y[3]-y[2])*(x[1]-x[0]);
       // if ((abs((y[0]-y[1])/(x[0]-x[1]))) == (abs((y[2]-y[3])/(x[2]-x[3]))))
        if (s == t)
        {
          cout <<"YES" <<endl; 
        } else
        {
          cout <<"NO" <<endl;
        }  
    }
 
     
    return 0;
}

C++: #include<iostream>
#include<cmath>
using namespace std;
int main()
{
	int n;cin>>n;
	for(;n--;)
	{
		float a,b,c,d,e,f,g,h;cin>>a>>b>>c>>d>>e>>f>>g>>h;
		if(abs(c-a)<1e-8||abs(g-e)<1e-8)cout<<(abs(c-a)<1e-8&&abs(g-e)<1e-8?"YES":"NO")<<endl;
		else cout<<(abs((d-b)*(g-e)-(h-f)*(c-a))<1e-8?"YES":"NO")<<endl;
	}
}

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

int main(){

	typedef struct{
		double x, y;
	}_td;

	int n;
	_td p1, p2, p3, p4, v_ab, v_cd;
	double del, eps;
	eps = 0.000001;
	
	cin >> n;
	
	for(int i=0; i<n; i++){
		cin >> p1.x >> p1.y >> p2.x >> p2.y >> p3.x >> p3.y >> p4.x >> p4.y;
	
		v_ab.x = p2.x - p1.x;
		v_ab.y = p2.y - p1.y;
		v_cd.x = p4.x - p3.x;
		v_cd.y = p4.y - p3.y;
		
		del = v_ab.x * v_cd.y - v_ab.y * v_cd.x;
		if(abs(del) < eps) cout << "YES" << endl;
		else cout << "NO" << endl;
	}

	return 0;

}

C++: #include<cstdio>

int n;
double point[4][2];

int main()
{
	scanf("%d",&n);
	for(int k=0;k<n;k++)
	{
	for(int i=0;i<4;i++)
	{
		for(int j=0;j<2;j++)
		{
			scanf("%lf",&point[i][j]);
		}
	}

	if((point[0][0]-point[1][0])*(point[2][1]-point[3][1])==(point[0][1]-point[1][1])*(point[2][0]-point[3][0])||(point[0][0]-point[1][0])*(point[2][1]-point[3][1])==(point[0][1]-point[1][1])*(point[2][0]-point[3][0]))
	{
		printf("YES\n");
	}
	else printf("NO\n");
	}
	return 0;
}

C++: #include <iostream>
#include <string>
#include <cctype>
#include <vector>
#include <complex>

using namespace std;

#define loop(i,a,b) for(int i=(a); i<int(b); i++)
#define rep(i,b) loop(i,0,b)

typedef vector<int> vi;
typedef long long ll;
typedef complex<double> vec;

double cross(const vec& a, const vec& b) {
  return imag(conj(a)*b);
}

int main(){
    int n;
    cin >> n;
    rep(_,n){
        double q,w,e,r,t,y,u,i;
        cin >> q>>w>>e>>r>>t>>y>>u>>i;
        vec a(q-e, w-r);
        vec b(t-u, y-i);
        double x = cross(a,b);
        if(abs(x)<1e-9){
            cout << "YES" << endl;
        }else{
            cout << "NO" << endl;
        }
    }
}

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

#define eps 0.000001

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;
    
        vector<double> v1, v2;
        v1.push_back(x2 - x1);
        v1.push_back(y2 - y1);
        v2.push_back(x4 - x3);
        v2.push_back(y4 - y3);
    
        double r1, r2;
        r1 = v1.at(1)/v1.at(0);
        r2 = v2.at(1)/v2.at(0);

        if( fabs(r1-r2) < eps ) cout << "YES\n";
        else cout << "NO\n";
    }
    return 0;
}

C++: #include <complex>
#include <iostream>
#include <cmath>
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;
	for (int i=0; i<N; ++i) {
		for (int i=0; i<4; ++i) {
			cin >> x[i] >> y[i];
		}
		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]))/2 < 0;
		cout << ( p ? "Yes" : "No") << endl;
	}
}

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;
}