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<stdio.h>
#include<math.h>
#include<string>
#include<algorithm>
#include<utility>
using namespace std;
double zeti(double);
int main() {
    pair<double,double> a;
    pair<double,double> b;
    pair<double,double>c;
    pair<double,double>d;
    int n;
    cin>>n;
    for(int i=0;i<n;++i){
        scanf("%lf%lf%lf%lf%lf%lf%lf%lf",&a.first,&a.second,&b.first,&b.second,&c.first,&c.second,&d.first,&d.second);
        if(a.first==b.first&&c.first==d.first){
            cout<<"YES"<<endl;
            continue;
        }
        double s1,s2;
        if(zeti(a.first*c.second-a.second*c.first)<=0.000001){
            cout<<"YES"<<endl;
        }
        else{
            cout<<"NO"<<endl;
        }
    }
    return 0;
}
double zeti(double a){
    if(a<0){
        a*=-1;
    }
    return a;
}

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

using namespace std;
const double eps = 1e-11;

typedef complex<double> xy_t;

double dotProduct(xy_t a, xy_t b){
	return (conj(a) * b).real();
}

double crossProduct(xy_t a, xy_t b){
	return (conj(a) * b).imag();
}

xy_t projection(xy_t p, xy_t b){
	return b*dotProduct(p,b)/norm(b);
}

int main (){
	int N;
	double X[4],Y[4];
	cin >> N;
	for(int t = 0; t < N; ++t){
		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]),
		};
		cout << ((abs(crossProduct(a[0],a[1])) < eps) ? "YES" : "NO") << endl;
	}
	return 0;
}

C++: #ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

//#ifdef __GXX_EXPERIMENTAL_CXX0X__
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
//#endif

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#include <array>
//#include <atomic>
#include <chrono>
//#include <condition_variable>
#include <forward_list>
//#include <future>
#include <initializer_list>
//#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <system_error>
//#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>


using namespace std;


class D3
{
public:
	double x;
	double y;
	double z;

	//?????????????????????
	D3 ( double x_ = 0.0 , double y_ = 0.0 , double z_ = 0.0 )
	{
		x = x_;
		y = y_;
		z = z_;
	}

	//??????
	D3 Cross_product ( D3 partner )
	{
		D3 ret ( y*partner.z - z*partner.y , z*partner.x - x*partner.z , x*partner.y - y*partner.x );
		return ret;
	}

	//??????
	double Inner_product ( D3 partner )
	{
		return x*partner.x + y*partner.y + z*partner.z;
	}

	//?????????????????????????????????
	D3 Make_vector ( D3 partner )
	{
		D3 ret ( partner.x - x , partner.y - y , partner.z - z );
		return ret;
	}

	//???????§????2????????????????????¢???????±???????
	double S_vec ( D3 A , D3 B )
	{
		D3 G;
		G = A.Cross_product ( B );
		return sqrt ( G.Inner_product ( G ) ) / 2;
	}

	//??????????????¢???????±???????
	double S_point ( D3 A , D3 B , D3 C )
	{
		return S_vec ( A.Make_vector ( B ) , A.Make_vector ( C ) );
	}

	//???????§????3????????????????????????????±???????
	double V_vec ( D3 A , D3 B , D3 C )
	{
		D3 G;
		G = A.Cross_product ( B );
		return G.Inner_product ( C ) / 6;
	}

	//4???????????????????±???????
	double V_point ( D3 A , D3 B , D3 C , D3 D )
	{
		return V_vec ( A.Make_vector ( B ) , A.Make_vector ( C ) , A.Make_vector ( D ) );
	}

	D3 operator+( D3 partner )
	{
		return D3 ( x + partner.x , y + partner.y , z + partner.z );
	}

	D3 operator-( D3 partner )
	{
		return D3 ( x - partner.x , y - partner.y , z - partner.z );
	}

	bool operator==( D3 partner )
	{
		return x == partner.x&&y == partner.y&&z == partner.z;
	}

	double length ()
	{
		return sqrt ( x*x + y*y + z*z );
	}

	//?????´????????????
	bool Vertical ( D3 partner )
	{
		return ( *this ).Inner_product ( partner ) == 0;
	}

	//??????????????????
	bool Parallel ( D3 partner )
	{
		return abs(abs ( ( *this ).Inner_product ( partner ) ) - abs ( ( *this ).length ()*partner.length () ))<1e-14;
	}
};

int main ()
{
	double a[8];
	int N;
	cin >> N;
	for( size_t k = 0; k < N; k++ )
	{
		for( size_t i = 0; i < 8; i++ )
		{
			cin >> a[i];
		}
		D3 A ( a[0] , a[1] ) , B ( a[2] , a[3] ) , C ( a[4] , a[5] ) , D ( a[6] , a[7] );
		D3 AB = B - A , CD = D - C;
		cout << ( AB.Parallel ( CD ) ? "YES" : "NO" ) << endl;
	}
	return 0;
}