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>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <functional>
#include <complex>
using namespace std;
int main() {
	double x[4],y[4];
	int n;
	cin >> n;
	for (int i = 0;i < n;i++) {
		for (int j = 0;j < 4;j++) {
				cin >> x[j] >> y[i];
		}
		double X1, Y1, X2, Y2;
		X1 = x[1] - x[0];
		X2 = x[3] - x[1];
		Y1 = y[1] - y[0];
		Y2 = y[3] - y[2];
		if (X1*Y2 == X2*Y1) {
			cout << "YES" << endl;
		}
		else cout << "NO" << endl;
	}
}

C++: #include <vector>
#include <iostream>
#include <utility>
#include <algorithm>
#include <string>
#include <deque>
#include <queue>
#include <tuple>
#include <queue>
#include <functional>
#include <cmath>
#include <iomanip>
#include <map>
#include <set>
#include <numeric>
#include <unordered_map>
#include <unordered_set>
#include <complex>
#include <iterator>
#include <array>
#include <memory>
#include <stack>
#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 all(in) in.begin(), in.end()
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
#define MAX 9999999
using namespace std;
typedef pair<int, int> pii;
typedef pair<double,double>pdd;
typedef pair<ll,ll>pll;
int main(){
    int n; cin>>n;
    rep(i,n){
    pdd a,b,c,d; cin>>a.first>>a.second>>b.first>>b.second;
    cin>>c.first>>c.second>>d.first>>d.second;
    if(abs((c.first-d.first)*(a.second-b.second)-(a.first-b.first)*(c.second-d.second))<=EPS)
        cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
    }
}

C++: #include<cstdio>
#include<iostream>
#include<cmath>
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;
        if((y1-y2)/(x1-x2)==(y3-y4)/(x3-x4))cout<<"YES"<<endl;
        else cout<<"NO"<<endl;
    }
    return 0;
}

C++: #include <bits/stdc++.h>

#define REP(i, a, b) for (int i = (int)(a); i < (int)(b); ++i)
#define rep(i, n) REP (i, 0, n)
#define mset(a, n) memset(a, n, sizeof(a))

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector<pair<int, int> > vpii;

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 cx1 = (x3 - x1) / 2.0;
		// double cy1 = (y3 - y1) / 2.0;
		// double cx2 = (x4 - x2) / 2.0;
		// double cy2 = (y4 - y2) / 2.0;
		// if (cx1 == cx2 && cy1 == cy2) {
		// 	cout << "YES" << endl;
		// } else {
		// 	cout << "NO" << endl;
		// }
		if ((y2 - y1) / (x2 - x1) == (y4 - y3) / (x4 -x3)) {
			cout << "YES" << endl;
		} else {
			cout << "NO" << endl;
		}
	}
}

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

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

typedef complex<double> xy_t;
double cross_product(xy_t a, xy_t b) { return (conj(a)*b).imag(); }
const double eps = 5e-11;
double x[4],y[4];
int N;
int main() {
	cin >> N;
	for (int i=0; i<N; ++i) {
		for (int i=0; i<4; ++i) {
			cin >> x[i] >> y[i];
		}
		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])/2) < eps;
		cout << ( p ? "Yes" : "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];
	double n1 = sqrt(x[0]*x[0]+y[0]*y[0]), n2 = sqrt(x[2]*x[2]+y[2]*y[2]);
	x[0] /= n1, y[0] /= n1, x[2] /= n2, y[2] /= n2;
	double dot = x[0]*x[2]+y[0]*y[2];
	if(abs(abs(dot)-1.) <= EPS)
	  cout << "YES" << endl;
	else
	  cout << "NO" << endl;
  }
  
  return 0;
}

C++: #include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>
#define rep(i,n) for(int i=0;i<n;i++)
typedef int long long ll;

using namespace std;
int main(){
    int n;
    cin>>n;
    rep(i,n){
    double x1,y1,x2,y2,x3,y3,x4,y4;
        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;
        }else{ cout<<"NO"<<endl;}
    
}
    return 0;
    
    
}

C++: #include<iostream>
#include<string.h>
#include<vector>
#include<list>
#include<stdio.h>
#define range(s,n) for(int i = s; i < n; i++)
#define debug(x) cout << "debug " << x << endl;
using namespace std;

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

	while(cin >> n){
		range(0,n){
			cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
			if( (y2 - y1) / (x2 - x1) == (y4 - y3) / (x4 - x3) )
				cout << "YES" << endl;
			else
				cout << "NO" << endl;
		}
	}
}