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++: #define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
using namespace std;
#ifndef FAST_IO
 #define IOS ios_base::sync_with_stdio(false);cin.tie(nullptr);
#endif

#define FILE_IO freopen("input.txt","r",stdin)
#define int long long
#define f first
#define s second
#define endl '\n'
#define all(c) c.begin(),c.end()
#define bp __builtin_popcount
#define debug(x) cerr << #x << " = " << x << endl;

const int MOD = 1e9 + 7;
const int INF = 1e18;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template <typename T>void print(T t){for(auto &it : t)cout<<it<<" ";}
inline int powerexp(int a, int b, int m = MOD){ int res = 1;while(b){if(b&1)res = res * a % m;a = a * a % m,b >>= 1;}return res % m;}
inline int modinv(int a){ return powerexp(a,MOD-2,MOD);}
inline int lcm(int a, int b){ int g = __gcd(a,b);return a/g*b;}
inline int add(int x, int y){ x += y; if (x >= MOD) x -=  MOD; return x;}
inline int mul(int x, int y){ return (x * 1ll * y) % MOD;}
inline int sub(int x, int y){ x -= y; if (x<0) x += MOD; return x ;}

//-------------------< start here >-------------------------// 

void solve(){
   int n;
   cin >> n;
   while(n--){
	 double x[4], y[4];
	 for(int i = 0; i < 4; i++){
		  cin >> x[i] >> y[i]; 
		}
	 if (fabs((x[3] - x[2]) * (y[1] - y[0]) - (x[1] - x[0]) * (y[3] - y[2])) < 1e-10){
		  cout << "YES" << endl;
		}
	 else cout << "NO" << endl; 
	 }
}

//-----------------------------
//comment from here for TOPCODER 
int32_t main(){
   IOS;
   solve();
   //find();
   #ifdef LOCAL_DEFINE
   cerr << "time elapsed " << (double)clock()/CLOCKS_PER_SEC << endl;
   #endif
}

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

int main()
{
	int n ;
	double ax,ay,bx,by,cx,cy,dx,dy ;

	cin >> n ;
	for( int i = 0 ; i < n ; i ++ )
	{
		cin >> ax >> ay >> bx >> by >> cx >> cy >> dx >> dy ;

		double a = (ay-by)/(ax-bx) ;
		double b = (cy-dy)/(cx-dx) ;

		if( a == b ) cout << "YES" << endl ;
		else	cout << "NO" << endl ;
	}
	return 0 ;
}

C++: #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 <ctime>
#include <cstring>

#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define vi vector<int>
#define VS vector<string>
#define all(x) x.begin(),x.end()
#define mp make_pair
#define pb push_back

using namespace std;

int main(){
    int n;
    cin >> n;
    for(int i=0; i < n; i++){
        double x1, y1, x2, y2, x3, y3, x4, y4;
        cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
        x1 -= x2; y1 -= y2;
        x3 -= x4; y3 -= y4;
        if(abs(x1*y3 - y1*x3)<1e-10) cout << "YES" << endl;
        else cout << "NO" << endl;
    }
}

C++: #include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<cmath>
#include<utility>
#include<set>
#include<complex>
#include<map>
#define vi vector<int>
#define vvi vector<vector<int> >
#define ll long long int
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
#define ld long double
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define CC puts("-------ok--------");
#define all(in) in.begin(), in.end()
using namespace std;
typedef pair<int, int> pii;
#define MAX 99999999
int main(){
    typedef pair<double, double>pdd;
    vector<pdd>v(5);
    int n;cin>>n;
    rep(i,n){
        rep(i,4)cin>>v[i].first>>v[i].second;
        double d1=(v[0].second-v[1].second)/(v[0].first-v[1].first);
        double d2=(v[2].second-v[3].second)/(v[2].first-v[3].first);
        if(d1-d2<EPS)cout<<"YES"<<endl;
        else cout<<"NO"<<endl;
    }
}

C++: #include <cstdio>
#include <bitset>
#include <cmath>
#include <complex>
#include <vector>
#include <algorithm>
#include <stack>
#include <iostream>
#define EPS 1e-6

using namespace std;
typedef complex<double> coor;

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

double dot(coor a, coor b)
{
  return a.real() * b.real() + a.imag() * b.imag();
}

int main()
{
  int N;
  scanf(" %d ", &N);
  
  for (int i = 0; i < N; i++) {
    coor c[4];
    for (int j = 0; j < 4; j++) {
      int x, y;
      scanf(" %d %d ", &x, &y);
      c[i] = coor(x, y);
    }
    if (cross(c[1] - c[0], c[3] - c[2])) {
      printf("YES\n");
    } else {
      printf("NO\n");
    }
  }
  return 0;
}

C++: #include <iostream>
#include <complex>
#include <cmath>
using namespace std;
int main() {
  int n;
  cin >> n;
  while (n--) {
    complex<double> p[4];
    for (int i = 0; i < 4; ++i) {
      double x, y;
      cin >> x >> y;
      p[i] = complex<double>(x, y);
    }
    complex<double> v1 = p[1] - p[0], v2 = p[3] - p[2];
    double a = abs(v1.real() * v2.imag() - v1.imag() * v2.real());
    cout << ((a < 1e-10) ? "YES" : "NO") << endl;
  }
}

C++: #include<iostream>
#define DFF 1E-19
using namespace std;
int main(){
  int n;
  cin >>n;
  while(n--){
    double p[4][2],ans;
    for(int i=0; i<4; i++) for(int j=0; j<2; j++) cin >>p[i][j];
    for(int i=0; i<2; i++) for(int j=0; j<2; j++) p[i*2][j]-=p[i*2+1][j];
    ans = p[0][0]*p[2][1]-p[0][1]*p[2][0];
    if(ans>-DFF && ans<DFF) cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
  }
  return 0;
}

C++: #define _USE_MATH_DEFINES
#include<iostream>
#include<complex>
using namespace std;
#define EPS 1e-10

int main(void){
	int n;
	cin >> n;
	for(int i=0; i<n; i++){
		complex<double> p1, p2, p3, p4;
		double x1, y1, x2, y2, x3, y3, x4, y4;
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		p1 = complex<double>(x1, y1);
		p2 = complex<double>(x2, y2);
		p3 = complex<double>(x3, y3);
		p4 = complex<double>(x4, y4);
		
		if( (arg(p1-p2) - arg(p3-p4))>-EPS && (arg(p1-p2) - arg(p3-p4))<EPS )
			cout << "YES" << endl;
		else if( (arg(p1-p2) + M_PI - arg(p3-p4))>-EPS && (arg(p1-p2) + M_PI - arg(p3-p4))<EPS )
			cout << "YES" << endl;
		else if( (arg(p1-p2) - M_PI - arg(p3-p4))>-EPS && (arg(p1-p2) - M_PI - arg(p3-p4))<EPS )
			cout << "YES" << endl;
		else
			cout << "NO" << endl;
	}
	return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
	double x1,x2,x3,x4,y1,y2,y3,y4;
	int n,i;
	cin>>n;
	for(i=0;i<n;i++){
		cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
		if((x2-x1)*(y4-y3)-(y2-y1)*(x4-x3)){
			cout<<"NO\n";
		}else{
			cout<<"YES\n";
		}
	}
}

C++: #include <bits/stdc++.h>
#define rep(i,l,n) for(int i=l;i<n;i++)
using namespace std;

int main(){
	int n;
	cin>>n;
	rep(i,0,n){
		double x1,y1,x2,y2,x3,y3,x4,y4,m1,m2;
		cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
		m1=(y2-y1)/(x2-x1);
		m2=(y4-y3)/(x4-x3);
		if(fabs(m1-m2)<1e-6) cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
	}
}