Go: package main

import "fmt"

func abs(x float64) float64 {
	if x < 0 {
		return -x
	}
	return x
}

func main() {
	var n int
	var x1, y1, x2, y2, x3, y3, x4, y4 float64
	fmt.Scan(&n)
	for i := 0 ; i < n; i++ {
		fmt.Scanf("%f %f %f %f %f %f %f %f", &x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4)
		if abs((x2-x1)*(y4-y3) - (y2-y1)*(x4-x3)) < 1e-10 {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

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

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

C++: import sys

# args = sys.argv

args = [int(float(a)) for line in sys.stdin]


class Point():
  def __init__(self,x,y):
      self.x = x
      self.y = y

  def __sub__(self,oth):
    self.x = self.x - oth.x
    self.y = self.y - oth.y
    return Point(self.x,self.y)

  def __str__(self):
    return "%s(%r)" %(self.__class__,self.__dict__)

for _ in range(args[0]):
  if _ == 0:
    pass
  else:
    A,B,C,D = ([Point(i,i+1) for i in range(0,8,2)])
    tmp = B - A
    tmp2 = C - D
    tmp3 = (tmp.x * tmp2.y) - (tmp.y * tmp2.x)
    if int(tmp3) == 0:
      print("YES")
    else:
      print("NO")

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

typedef complex<double> P;

P in(){
	double x,y;
	cin >> x >> y;
	return P(x,y);
}
double cross(P a,P b){
	return imag(a*conj(b));
}
int main(){
	int N;
	cin >> N;
	while(N--){
		P a,b,c,d;
		a = in();
		b = in();
		c = in();
		d = in();
		if( abs(cross(a-b,c-d))<1e-12) cout << "YES" << endl;
		else cout << "NO" << endl;
	}
		
}

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

int main(){
  int n;
  cin>>n;
  while(n--){
    double x1,y1,x2,y2,x3,y3,x4,y4;
    cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
    double abx=x1-x2;
    double aby=y1-y2;
    double cdx=x3-x4;
    double cdy=y3-y4;
    if(abx == aby)
      cout<<"YES"<<endl;
    else if(abx || aby){
      cout<<"NO"<<endl;
    }else if(aby/abx == cdy/cdx)
      cout<<"YES"<<endl;
    else
      cout<<"NO"<<endl;
  }
  return 0;
}

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

int main()
{
    float a,s,d,f,g,h,j,k;
    float q,w,e,r;
        int n;
    cin>>n;
    for(int i=0; i<n; i++){
        cin>>a>>s>>d>>f>>g>>h>>j>>k;
        q=d-a;
    w=f-s;
    e=j-g;
    r=k-h;
        int key=q*r-w*e;
        if(!key)cout<<"YES"<<endl;
        else  cout<<"NO"<<endl;
    }
    return 0;
}

C++: #include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define int long long
using namespace std;
typedef pair<int, int> P;

signed main(){
    int n;
    cin >> n;
    double x[4], y[4];
    rep(i, 0, n){
        rep(j, 0, 4){
            cin >> x[j] >> y[j];
        }
        double h1, h2;
        h1 = (y[1] - y[0]) / (x[1] - x[0]);
        h2 = (y[3] - y[2]) / (x[3] - x[2]);
        if(fabs(h1 - h2) < 1e-8) cout << "YES" << endl;
        else cout << "NO" << endl;
    }
}

C++: #include <iostream>
#include <cmath>
using namespace std;
int main(void){
    int n;
    cin >> n;
    double x1, y1, x2, y2, x3, y3, x4, y4;
    for(int i = 0; i < n; i++){
        cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
        double a,b;
        a = 10000.0;
        b = 10000.0;
        if(x1 != x2){
            a = (y2 - y1) / (x2 - x1);
        }
        if(x3 != x4){
            b = (y4 - y3) / (x4 - x3);
        }
        if(fabs(b - a) < 0.0000000001){
            cout << "YES" << endl;
        }
        else{
            cout << "NO" << endl;
        }
    }
    
    return 0;
}

C++: #include<vector>
#include<iostream>
#include<cstdio>
using namespace std;
double x1,y1,x2,y2,x3,y3,x4,y4;
int n;
int main()
{
  scanf("%d\n",&n);
  for(int i = 0;i < n;i++){
    double x1,y1,x2,y2,x3,y3,x4,y4;
    scanf("%lf%lf%lf%lf%lf%lf%lf%lf",&x1,&y1,&x2,&y2,&x3,&y3,&x4,&y4);
    if((y2-y1)/(x2-x1)==(y4-y3)/(x4-x3)) printf("YES\n");
    else printf("NO\n");
    
  }
  return 0;
}