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

double EPS = 1e-8;

//??\????????°???????????°?????????????????????
//????¬?????????????????????????
//??¢??°vAdd, vSet????????????????????????????????¢?????????????????¶public:
//???????????????????????°??????????????§????????¨?????¶
//??\???????????§??????????????????????????????????????????????????????
class C3DVec{
    private:    //private: ????????¨???????????¢??????????????§?????????
    
    public:     //public: ????????¨???????????¢???????????????
    double x, y;
    
    //??°????????????????????????+????????????????????????
    C3DVec operator+(C3DVec v2){
        C3DVec vRet;
        
        //???????????????v?????¨??????
        vRet.x = x + v2.x;
        vRet.y = y + v2.y;
    
        return vRet;
    }
    
    //????§???????????????????????????????
    C3DVec operator-(C3DVec v2){
        C3DVec vRet;
        
        //???????????????v1??¨??????
        vRet.x = x - v2.x;
        vRet.y = y - v2.y;
        
        return vRet;
    }
    
    //????§?????????????????????¨??????????????????????????????
    C3DVec operator*(float sc){
        C3DVec vRet;
        
        vRet.x = x * sc;
        vRet.y = y * sc;
        
        return vRet;
    }
    
    
    
    //()????????????????????????????????°????????????????????±??????
     void operator() (double ix, double iy){
        C3DVec vRet;
    
        x = ix;
        y = iy;
    }
};

//???????????¨?????\??????????????????????????????????????????????????????????????¢??°
C3DVec operator*(float sc, C3DVec vi){
    C3DVec vRet;
    
    //?????????????????????????????????????????°????????????????????§???
    //??¢??°??????????????????????????????????????????
    vRet.x = vi.x * sc;
    vRet.y = vi.y * sc;
    
    return vRet;
}

//????????????????????????????????????
    double dot(C3DVec v1, C3DVec v2){
        return (v1.x * v2.x) + (v1.y * v2.y);
    }


int main(void){
    C3DVec va, vb, vc, vd;
    double x1, x2, x3, x4, y1, y2, y3, y4;
    int n;
    
    cin >> n;
    for(int i = 0; i < n; i++){
        //??????????????????
        cin >> x1 >> y1 >> x2 >> y2;
        cin >> x3 >> y3 >> x4 >> y4;
        
        //?????????????????????
        va(x1, y1);
        vb(x2, y2);
        vc(x3, y3);
        vd(x4, y4);
        
        //????????????????????????
        C3DVec vAB = vb - va;
        C3DVec vCD = vd - vc;
         
        //???????????¶????????????????????????
        if(dot(vAB, vCD) < 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];
	cin >> n;

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

		double l1, l2;
		l1 = (y[0] - y[1]) / (x[0] - x[1]);
		l2 = (y[2] - y[3]) / (x[2] - x[3]);
		if (l1 == l2){
			cout << "YES" << endl;
		}

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

C++: #include <iostream>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <numeric>
#include <string>
#include <vector>
#include <list>
#include <iterator>

#include <cmath>

typedef std::pair<double,double> Vec;
typedef std::pair<Vec,Vec> Line;

Vec operator+(const Vec& lhs, const Vec& rhs) {
	return std::make_pair(lhs.first+rhs.first, lhs.second+rhs.second);
}

Vec operator-(const Vec& lhs, const Vec& rhs) {
	return std::make_pair(lhs.first-rhs.first, lhs.second-rhs.second);
}

Vec lineToVec(const Line& l) {
	return l.first - l.second;
}

double cross(const Vec& lhs, const Vec& rhs) {
  return lhs.first*rhs.second - lhs.second*rhs.first;
}

int main(void){
	using namespace std;

	int n;
	cin >> n;

	vector< pair<Line,Line> > input;
	input.reserve(n);

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

		auto AB = make_pair( make_pair(x1,y1), make_pair(x2,y2) );
		auto CD = make_pair( make_pair(x3,y3), make_pair(x4,y4) );

		input.push_back(make_pair(AB,CD));
	}

	for(auto itr=input.begin(); itr!=input.end(); itr++){
		auto AB = itr->first;
		auto CD = itr->second;

		auto cr = cross( lineToVec(AB), lineToVec(CD) );

		if( abs(cr) <10e-300 ){
			cout << "YES";
		}
		else{
			cout << "NO";
		}
		if( distance( itr, input.end() )>1 ){
			cout << endl;
		}
	}
}

C++: #include<iostream>
#include<cstdio>
#include<string>
//#define nINF -2147483648
using namespace std;
/*
int p10(int x)  //10^x
{
	int d141771=1; for (int i=1;i<=x;i++) d141771*=10; return d141771;
}
*/
int main()
{
	double x1,y1,x2,y2,x3,y3,x4,y4,k1,k2,z1,z2,z3,z4;
	int n;
	cin>>n;
	bool up1,up2;
	for (int k=1;k<=n;k++)
	{
		cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
		k1=0; k2=0;
		up1=false; up2=false;
		z1=y1-y2; z2=x1-x2;
		z3=y3-y4; z4=x3-x4;
		if (z2==0) up1=true;
		if (z4==0) up2=true;
		if (z2!=0) k1=z1/z2;
		if (z4!=0) k2=z3/z4;
		if (z2!=0&&z4!=0)
		{
			if (k1==k2) cout<<"YES"<<endl;
			else cout<<"NO"<<endl;
		}
		else
		{
			if (k1==k2&&up1==up2) cout<<"YES"<<endl;
			else cout<<"NO"<<endl;
		}
	}
	return 0;
}

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

using namespace std;

int main() {
	int k;
	double x1,x2,x3,x4,y1,y2,y3,y4;
	double veku1[2];
	double veku2[2];
	double veku3[2];
	double t;
	double m;
	cin >> k;

	for (int i = 0; i < k; i++) {
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		veku1[0] = x2 - x1;
		veku1[1] = y2 - y1;
		veku2[0] = x4 - x3;
		veku2[1] = y4 - y3;
		if (((veku1[0] * veku2[1]) - (veku1[1] * veku2[0])) == 0) {
			cout << "YES" << endl;
		} else {
			cout << "NO" << endl;
		}
	}
	return 0;
}

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

#define REP(i, s, n) for (int i = s; i < n; ++i)
#define rep(i, n) REP(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define IINF INT_MAX
#define LLINF LLONG_MAX
#define DEBUG false

int main()
{
    int n;
    cin >> n;
    rep(j, n)
    {
        double a[8];
        rep(i, 8)
        {
            cin >> a[i];
        }
        double ans = (a[2] - a[0]) * (a[7] - a[5]) - (a[3] - a[1]) * (a[6] - a[4]);
        if ((a[2] - a[0]) == 0 && (a[6] - a[4]) == 0)
        {
            cout << "YES" << endl;
        }
        else if ((a[2] - a[0]) == 0 || (a[6] - a[4]) == 0)
        {
            cout << "NO" << endl;
        }
        else if (ans < 0.0000001)
        {
            cout << "YES" << endl;
        }
        else
        {
            cout << "NO" << endl;
        }
    }
    return 0;
}

C++: #include <iostream>

int main(int argc, const char * argv[]) {
    int num;
    std::cin >> num;
    double x1,y1,x2,y2,x3,y3,x4,y4;
    
    for(int i = 0;i < num;i++){
        std::cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
        double a = (y1-y2)/(x1-x2);
        double b = (y3-y4)/(x3-x4);
         std::cout <<  (a==b ? "YES":"NO") << '\n';
    }
}