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)
		}
		if fpoints[0] == fpoints[2] && fpoints[4] == fpoints[6] {
			fmt.Println("YES")
			continue
		}
		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>
using namespace std;
int main(){
  double x1,y1,x2,y2,x3,y3,x4,y4,a,b,n;
  cin >> n;
  for(int i=0;i<n;i++){
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
    a = (y2-y1) / (x2-x1);
    b = (y4-y3) / (x4-x3);
    a == b ? cout << "YES" << endl : cout << "NO" << endl;
  }
  return 0;
}

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

using namespace std;

int main() {
	int k;
	double x1,x2,x3,x4,y1,y2,y3,y4;
	double veku1[2];
	double veku2[2];
	double veku3[2];
	double t;
	double m;
	cin >> k;

	for (int i = 0; i < k; i++) {
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		veku1[0] = x2 - x1;
		veku1[1] = y2 - y1;
		veku2[0] = x4 - x3;
		veku2[1] = y4 - y3;

		t = veku1[0] * veku2[0] + veku1[1] * veku2[1];

		if (t * t != (veku1[0] * veku1[0] + veku1[1] * veku1[1]) * (veku2[0] * veku2[0] + veku2[1] * veku2[1])) {
			cout << "NO" << endl;
		} else {
			if (x1 == x4 && y1 == y4) {
				veku3[0] = x3 - x1;
				veku3[1] = y3 - y1;
			} else {
				veku3[0] = x4 - x1;
				veku3[1] = y4 - y1;
			}
			m = veku1[0] * veku3[0] + veku1[1] * veku3[1];
			if (m * m != (veku1[0] * veku1[0] + veku1[1] * veku1[1]) * (veku3[0] * veku3[0] + veku3[1] * veku3[1])) {
				cout << "YES" << endl;
			} else {
				cout << "NO" << endl;
			}
		}
	}
	return 0;
}

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

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

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){
        double x_,y_;
        ll x[2][2], y[2][2];
        rep(i,2){
            rep(j,2){
                cin >> x_ >> y_;
                x[i][j] = x_*100000;
                y[i][j] = y_*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];
        puts(dx1*dy2==dx2*dy1 ? "NO" : "YES");
    }
}

C++: #include <iostream>
#include <iomanip>
#include <list>
#include <map>
#include <algorithm>
#include <stack>
#include <string>
#include <vector>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>

using namespace std;


int main(){
	vector<pair<double,double> > factor(4);
	pair<double,double> tmp;
	int n;
	cin >> n;
	while(n--){
		for(int i = 0; i < 4; i++){
			cin >> factor[i].first >> factor[i].second;
		}
		for(int i = 0; i < 4; i++){
			if(i % 2 == 1){
				factor[i].first += tmp.first;
				factor[i].second += tmp.second;
			}
			else{
				tmp.first = 0 - factor[i].first;
				tmp.second = 0 - factor[i].second;
				factor[i].first += (0 - factor[i].first);
				factor[i].second += (0 - factor[i].second);
			}
		}

		if(factor[0].first == factor[2].first && factor[0].second == factor[2].second){
			if(factor[1].first == factor[3].first && factor[1].second == factor[3].second){
				cout << "YES" << endl;
			}
			else{
				cout << "NO" << endl;
			}
		}
		else{
			cout << "NO" << endl;
		}
	}
	
	return 0;
}

C++: #include <iostream>

using namespace std;
int main(void){
    // Here your code !
int n;
double x1,x2,x3,x4,y1,y2,y3,y4;
cin>>n;
for(int i=0;i<n;i++){
cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
if(x1==x2&&x3==x4) cout<<"YES"<<endl;
else if(y1==y2&&y3==y4) cout<<"YES"<<endl;
else{
    
    if( double((y2-y1)/(x2-x1)) ==double( (y4-y3)/(x4-x3) ) )
    cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
}
}
return 0;
}

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

int main() {
  int n;
  double x1, y1, x2, y2, x3, y3, x4, y4;
  cin >> n;
  while (n--) {
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
    if (fabs((x2 - x1) * (y4 - y3) - (x4 - x3) * (y2 - y1)) < EPS) {
      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] == 0.)
	  cout << "YES" << endl;
	else
	  cout << "NO" << endl;
  }
  
  return 0;
}

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


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

	cin >> n;
	for(int i = 0;i < n;i++){
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		double xa = x2 - x1, ya = y2 - y1;
		double xc = x4 - x3, yc = y4 - y3;
		double cp = xa*yc - xc*ya;
		if(abs(cp) < 0.0000000001) cout << "YES" << endl;
		else cout << "NO" << endl;
	}

	return 0;
}