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++: #include<bits/stdc++.h>
using namespace std;
 
typedef long long int ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pair<int, int> > vii;
#define rrep(i, m, n) for(int (i)=(m); (i)<(n);  (i)++)
#define erep(i, m, n) for(int (i)=(m); (i)<=(n); (i)++)
#define  rep(i, n)    for(int (i)=0; (i)<(n);  (i)++)
#define  rev(i, n)    for(int (i)=(n)-1; (i)>=0; (i)--)
#define vrep(i, c)    for(__typeof((c).begin())i=(c).begin(); i!=(c).end(); i++)
#define  ALL(v)       (v).begin(), (v).end()
#define mp            make_pair
#define pb            push_back
template<class T1, class T2> inline void minup(T1& m, T2 x){ if(m>x) m=static_cast<T2>(x); }
template<class T1, class T2> inline void maxup(T1& m, T2 x){ if(m<x) m=static_cast<T2>(x); }
 
#define INF 1000000000
#define MOD 1000000009
#define EPS 1E-12
 
template<class T> T add(T x, T y){ if(abs(x+y) < EPS*(abs(x)+abs(y))) return 0; return x + y; }
template<class T> inline bool semieq(T x, T y){ return abs(x - y) < EPS; }
template<class T> inline bool semige(T x, T y){ return x - y > -EPS; }
template<class T> inline bool semile(T x, T y){ return y - x > -EPS; }
 
template<class Type> struct Line;
 
template<class Type>
struct P
{
  friend struct Line<Type>;
private:
  complex<Type> z;
 
public:
  P(const Type x = 0, const Type y = 0) : z(complex<Type>(x, y)) { }
  void setter(Type x, Type y) { z = complex<Type>(x, y); }
  Type getX(){ return z.real(); }
  Type getY(){ return z.imag(); }
  inline double getSlope(){ return tan(z.arg()); }
  inline double getSlope(P<Type> p){ return (this - p).getSlope(); }
 
  bool operator == (const P<Type> p){ return  semieq(z.real(), p.real()) &&  semieq(z.imag(), p.imag()); }
  bool operator != (const P<Type> p){ return !semieq(z.real(), p.real()) || !semieq(z.imag(), p.imag()); }
  Type operator * (const P<Type> p){ return (z * p.z).real(); }
  Type operator / (const P<Type> p){ return (z * p.z).imag(); }
};
 
template<class Type>
struct Line
{
private:
  P<Type> S, T;
 
public:
  Line(const Type sx, const Type sy, const Type tx, const Type ty) : S(sx, sy), T(tx, ty) {}
  Line(const P<Type> S, const P<Type> T) : S(S), T(T) {}
  inline P<Type> getS(){ return S; }
  inline P<Type> getT(){ return T; }
  inline double getSlope(){ return S.getSlope(T); }
  inline bool isParallel(Line<Type> L){ return semieq(((L.S.z - L.T.z) / (S.z - T.z)).imag(), 0.0); }
  inline bool isVertical(Line<Type> L){ return semieq(((L.S.z - L.T.z) / (S.z - T.z)).real(), 0.0); }
};
 
typedef double Point;
 
int n;
P<Point> A[4];
Point x, y;
 
int main()
{
  cin >> n;
 
  while(n--){
    rep(i, 4){
      cin >> x >> y;
      A[i].setter(x, y);
    }
    Line<Point> AB(A[0], A[1]);
    Line<Point> CD(A[2], A[3]);
    puts(AB.isParallel(CD) ? "YES" : "NO");
  }
 
  return 0;
}

C++: #include <iostream>

int main(){
	
	double a,x1,y1,x2,y2,x3,y3,x4,y4;
	std::cin>>a;
	for(double s=0;s<a;s++){
		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;
		}
		
    }
    return 0;
}

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

int main(void)
{
	double x[4]={0},y[4]={0},x1,x2,y1,y2;
	int i;
	scanf("%d",&i);

	while(i!=0)
	{
		scanf("%f %f %f %f %f %f %f %f",&x[0],&y[0],&x[1],&y[1],&x[2],&y[2],&x[3],&y[3]);
		if(fabs(x[0])>100 ||fabs(y[0])>100 ||fabs(x[1])>100 ||fabs(y[1])>100 ||
			fabs(x[2])>100 ||fabs(y[2])>100||fabs(x[3])>100||fabs(y[3])>100)break;
		x1 = x[1]-x[0];   y1 = y[1]-y[0];
		x2 = x[3]-x[2];   y2 = y[3]-y[2];
		if(x1==0 && x2==0)
			printf("YES\n");
		else if(x1==0  || x2==0)
			printf("NO\n");
		else if((y1/x1) == (y2/x2))
			printf("YES\n");
		else 
			printf("NO\n");

		i-=1;
	}
 return 0;
}

C++: #include <stdio.h>
struct point{
    double x;
    double y;
};
int main(){
    int n;
    point a[4];
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        for(int j=0;j<4;j++){
            scanf("%lf%lf",&a[j].x,&a[j].y);
        }
        if((a[1].x-a[0].x)*(a[3].y-a[2].y)==(a[3].x-a[2].x)*(a[1].y-a[0].y))printf("YES\n");
        else printf("NO\n");
    }
}

C++: #include <iostream>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <string>
#include <math.h>
#include <functional>
#include <algorithm>

typedef long long Int;
#define REP(i,n) for(int i = 0 ; i < n ; ++i)
using namespace std;

int main(){
	int n;
	cin >> n;

	REP(i, n){

		double p[8];
		REP(i, 8){
			cin >> p[i];
		}

		string ans = ((p[3] - p[1])/(p[2] - p[0]) == (p[7] - p[5])/(p[6] - p[4])) ? "YES" : "NO";


		cout << ans << endl;
	}
	return 0;
}

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

int main(){
	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 a0 = (y2-y1) / (x2-x1), a1 = (y4-y3) / (x4-x3);
		if(a0 == a1) cout<<"YES"<<endl;
        else cout<<"NO"<<endl;
	}
	return 0;
}

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

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

C++: #include <iostream>
#include <cstdio>
#include <complex>
#define EPS 1e-10
#define EQ(a, b) (abs((a) - (b)) < EPS)
using namespace std;

typedef complex<double> P;

double cross(P a, P b) {
    return(a.real() * b.imag() - a.imag() * b.real());
}

int isPalallel(P a,P a2, P b, P b2) {
    return(EQ(cross(a-a2, b-b2), 0.0));
}

int main(void) {
    int num; cin >> num;
    
    for(int r = 0; r < num; r++) {
        double x1, y1, x2, y2, x3, y3, x4, y4; cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
        P a(x1, y1), b(x2, y2), c(x3, y3), d(x4, y4);
        if(isPalallel(a, b, c, d)) cout << "YES" << endl;
        else cout << "NO" << endl;
    }
    return(0);
}

C++: #define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <sstream>
#include <utility>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;
#define all(c) (c).begin(), (c).end()
#define loop(i,a,b) for(ll i=a; i<ll(b); i++)
#define rep(i,b) loop(i,0,b)
#define each(e,c) for(auto&e:c)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define lb lower_bound
#define ub upper_bound
#ifdef DEBUG
#define dump(...) (cerr<<#__VA_ARGS__<<" = "<<(DUMP(),__VA_ARGS__).str()<<" ["<<__LINE__<<"]"<<endl)
struct DUMP:ostringstream{template<class T>DUMP &operator,(const T&t){if(this->tellp())*this<<", ";*this<<t;return *this;}};
#else
#define dump(...)
#endif

int main(){
    int n; cin>>n;
    rep(_,n){
        ll x[2][2], y[2][2];
        rep(i,2){
            rep(j,2){
                double x_,y_;
                cin >> x_ >> y_;
                x[i][j] = (x_ + 5e-6)*100000;
                y[i][j] = (y_ + 5e-6)*100000;
            }
        }
        ll dx1=x[0][0]-x[0][1], dy1=y[0][0]-y[0][1];
        ll dx2=x[1][0]-x[1][1], dy2=y[1][0]-y[1][1];
        dump(dx1,dx2,dy1,dy2);
        puts(dx1*dy2==dx2*dy1 ? "YES" : "NO");
    }
}