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<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<ctime>
#include<cctype>
#include<climits>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<memory>
#include<functional>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;

typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<double> vd;
typedef pair<int, int> pii;
typedef pair<long, long> pll;
typedef long long ll;

int dy[] = { 0, 0, 1, -1, 0 };
int dx[] = { 1, -1, 0, 0, 0 };

int main(){
	ios::sync_with_stdio(false);

	int n;
	scanf("%d", &n);

	double a[2], b[2], c[2], d[2];
	double e=0.00000001;


	while(n--){
		scanf("%lf %lf %lf %lf %lf %lf %lf %lf", &a[0], &a[1], &b[0], &b[1], &c[0], &c[1], &d[0], &d[1]);

		double l1, l2;
		bool p=false;

		if((fabs(a[0]-b[0])<e)&&(fabs(c[0]-d[0])<e)){
			p=true;
		}else if((fabs(a[0]-b[0])>e)&&(fabs(c[0]-d[0])>e)){
			l1=(b[1]-a[1])/(b[0]-a[0]);
			l2=(d[1]-c[1])/(d[0]-c[0]);

			if(fabs(l2-l1)<e)	p=true;
		}

		if(p){
			printf("YES\n");
		}else{
			printf("NO\n");
		}
	}

}

C++: #include <complex>
#include <cmath>
#include <stdio.h>
#include <iostream>
using namespace std;
typedef complex<double> xy_t;
const double eps = 1e-11;
double x[4], y[4];
int N;

double cross_product(xy_t a,xy_t b) {
  return (conj(a)*b).imag()/2.0;
}

int main() {
  cin >> N; //????????°
  for (int t=0; t<N; ++t) {
    for (int i=0; i<4; ++i)
      cin >> x[i] >> y[i]; //x0,y0,...,x3,y3
    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])) < eps;
    cout << (p ? "YES" : "NO") << endl;
  }
}

C++: #include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=n;i>=0;i--)
#define all(v) v.begin(),v.end()
template<typename T>T rad(T deg){return deg*M_PI/180;}
template<typename T>bool eq(T a,T b){return ((a-b)<=1e-8)?true:false;}
using namespace std;
int main() {
    int n;
    cin >> n;
    rep(j,n) {
        complex<double> a[4];
        rep(i, 4) {
            double x, y;
            cin >> x >> y;
            a[i] = *(new complex<double>(x, y));
        }
        complex<double> vAB = a[0] - a[1];
        complex<double> vCD = a[2] - a[3];
        if (eq(vAB.real(), 0.0)) {
            cout << ((eq(vCD.real(), 0.0)) ? "YES" : "NO") << endl;
        } else if(eq(vCD.real(),0.0)){
            cout << ((eq(vAB.real(), 0.0)) ? "YES" : "NO") << endl;
        }else{
            double m1 = vAB.imag() / vAB.real();
            double m2 = vCD.imag() / vCD.real();
            cout << ((eq(m1, m2)) ? "YES" : "NO") << endl;
        }
    }
}

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

const double EPS = 1e-8;

double outp(double x1, double y1, double x2, double y2) {
  return x1*y2 - y1*x2;
}

int sig(double x) {
  if(x < -EPS) return -1;
  if(x > +EPS) return +1;
  return 0;
}

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;
    x2 -= x1; y2 -= y1;
    x4 -= x3; y4 -= y3;
    if(sig(outp(x2, y2, x4, y4)) == 0) {
      cout << "YES" << endl;
    }
    else {
      cout << "NO" << endl;
    }
  }
}

C++: #include<iostream>

using namespace std;

bool get_line( double x1 , double x2 , double y1 , double y2 , double& a , double& b );

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

	double a1, a2;
	double b1, b2;

	bool result1 , result2;

	int num;

	cin >> num;

	for( int i = 0 ; i < num ; i++ )
	{
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;

		result1 = get_line( x1 , x2 , y1 , y2 , a1 , b1 );
		result2 = get_line( x3 , x4 , y3 , y4 , a2 , b2 );

		if( result1 == false && result2 == false ) cout << "YES" << endl;

		else
		{
			if( a1 == a2 ) cout << "YES" << endl;
			else cout << "NO" << endl;
		}
	}

	return 0;
}

bool get_line( double x1 , double x2 , double y1 , double y2 , double& a , double& b )
{
	// if( x1 - x2 >= -0.0000001 && x1 - x2 <= 0.0000001 ) return false;

	if( x1 == x2 ) return false;
	else
	{
		a = ( y1 - y2 ) / ( x1 - x2 );
		b = y1 - a * x1;
		return true;
	}
}

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



int main(){

  int num;
  cin >> num;

  double x[4], y[4];
  double xx, yy;
  int i = 0;

  while( i < num ){
  for( int j = 0; j < 4; j++ ){
    cin >> x[j] >> y[j];
  }
  if((y[1]- y[0]) / (x[1] - x[0]) == (y[3] - y[2]) / (x[3] - x[2]) ){
    cout <<"YES"<< endl;
  }else{
    cout <<"NO"<< endl;
  }
  i++;
  }

 
  return 0;
}

C++: #include <algorithm>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <cctype>
#include <iostream>
#include <set>
#include <string>
#include <queue>
#include <map>
#include <utility>
using namespace std;
int size(string x){
	string::size_type size=x.size();
	return size;
}
#define fu(l,k) for(int i=l;i<k;i++)
#define fd(l,k) for(int i=l;i>k;i--)
#define sort(ss) sort(ss.begin(), ss.end())
#define rsort(ss) sort(ss.rbegin(), ss.rend())
typedef  vector<string> vs;
typedef  vector<int> vi;
double pi(){
	return acos(-1.0);
}
typedef set<int> set_i;
typedef set<string> set_s;
int INF=1000000;
int main(){
	int n,ans;
	double x1,x2,x3,x4,y1,y2,y3,y4;
	double ab,cd;
	cin>>n;
	ans=0;
	for(int i=0;i<n;i++){
		cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
		if(x1-x2!=0.0) ab=(y1-y2)/(x1-x2);
		else ab=INF;
		if(x3-x4!=0) cd=(y3-y4)/(x3-x4);
		else cd=INF;
		if(ab==cd) cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
	}
}

C++: //include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <queue>

using namespace std;

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-5;
const double PI  = acos(-1.0);

int main(){
  cin.tie(0);
  ios_base::sync_with_stdio(false);

  int N; cin >> N;
  REP(n,N){
	double x[4], y[4];
	REP(i,4)
	  cin >> x[i] >> y[i];
	x[0] -= x[1], y[0] -= y[1], x[2] -= x[3], y[2] -= y[3];

	if(x[0]*y[2]-x[2]*y[0] < EPS)
	  cout << "YES" << endl;
	else
	  cout << "NO" << endl;
  }
  
  return 0;
}