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)
		}
		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++: #define _USE_MATH_DEFINES
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<cctype>
#include<cmath>
#include<cstdio>
#include<deque>
#include<list>
#include<set>
#include<stack>
#include<string>
#include<sstream>
#include<map>
#include<queue>
#include<vector>
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;
		double ABx = x2 - x1,
			ABy = y2 - y1,
			CDx = x4 - x3,
			CDy = y4 - y3;
		if (ABx / ABy == CDx / CDy)cout << "YES" << endl;
		else cout << "NO" << endl;
	}
	return 0;
}

C++: #include<iostream>
using namespace std;int main(){
int n=2,ab=0,cd=0;
double point1[20]={0.0,0.0,1.0,1.0,1.0,0.0,2.0,1.0};
double point2[20]={3.0,2.0,9.0,6.0,13.0,5.0,7.0,9.0};

ab = ((1.0-0.0)/(1.0-0.0));
cd = ((1.0-0.0)/(2.0-1.0)); if( ab = cd) cout << "YES\n" ;
else cout << "NO\n" ;

ab = ((6.0-2.0)/(9.0-3.0));
cd = ((9.0-5.0)/(7.0-13.0)); if( ab = cd) cout << "YES\n" ;
else cout << "NO\n" ;    return 0;
}

C++: #include <bits/stdc++.h>
/* Karen {{{
  ___  ____
 |_  ||_  _|
   | |_/ /    ,--.   _ .--.  .---.  _ .--.
   |  __'.   `'_\ : [ `/'`\]/ /__\\[ `.-. |
  _| |  \ \_ // | |, | |    | \__., | | | |
 |____||____|\'-;__/[___]    '.__.'[___||__]
}}} */
/* cpp template {{{*/
using namespace std;

#define endl '\n'

#define REP(i, n) for (int i = 0; i < (n); i++)
#define REPS(i, a, n) for (int i = (a); i < (n); i++)
#define RREP(i, n) for (int i = 1; i <= (n); i++)
#define X real()
#define Y imag()
#define EQ(n,m) (abs((n)-(m)) < EPS)

typedef double D;
typedef long long ll;
typedef long double lb;
typedef complex<D> P;
typedef vector<P> VP;
typedef vector<int> vi;
typedef vector<vector<int> > vii;
typedef pair<int, int> pii;
typedef pair<int, string> pis;
typedef pair<string, int> psi;

inline bool inside(int y,int x,int H,int W){return(y>=0&&x>=0&&y<H&&x<W);}
inline int in() {int x; std::cin >> x; return x;}

template <typename T>
void print(std::vector<T>& v, char c = ' ') {
  REP(i, v.size()) {
    if (i != 0) std::cout << c;
    std::cout << v[i];
  }
  std::cout << endl;
}
template <typename T>
void print(T x) {
  std::cout << x << '\n';
}
/* }}} */
/* ?????° {{{*/
const ll MOD = 1e9 + 7;
const ll INF = 1e9 + 9;
const D EPS  = 1e-5;
const int dx[] = {0, 1, 0, -1, 1, -1, 1, -1};
const int dy[] = {1, 0, -1, 0, 1, -1, -1, 1};
/* }}} */

signed main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);

  int n = in();
  float x[4], y[4];

  while(n--){
    REP(i, 4) cin >> x[i] >> y[i];
    float l1 = (y[1] - y[0]) / (x[1] - x[0]), l2 = (y[3] - y[2]) / (x[3] - x[2]);
    if (l1 == l2){
      cout << "YES" << endl;
    } else {
      cout << "NO" << endl;
    }
  }
  return (0);
}

C++: #include<iostream>

using namespace std;

int main(void){
	
	int n;
	double x1,x2,x3,x4,y1,y2,y3,y4,ab,cd;
	
	cin>>n;
		
	for(int i=0;i<n;i++){
		
		cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
		ab=(x1-x2)/(y1-y2);
		cd=(x3-x4)/(y3-y4);

		if(ab==cd){
			cout<<"YES"<<endl;
		}else{
			cout<<"NO"<<endl;
		}
	}
}

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


int main(){
	int n;
	pair <double, double> a, b, c, d;

	cin >> n;

	for (int i = 0; i < n; i++){
		cin >> a.first >> a.second;
		cin >> b.first >> b.second;
		cin >> c.first >> c.second;
		cin >> d.first >> d.second;

		double x1, x2, y1, y2;
		x1 = b.first - a.first;
		y1 = b.second - a.second;
		x2 = d.first - c.first;
		y2 = d.second - c.second;

		if (x1*y2 - x2*y1 == 0) 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_ + 1e-8)*100000;
                y[i][j] = (y_ + 1e-8)*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");
    }
}

C++: #include<iostream>
#include<string>
using namespace std;
int main(){
	string s;
	double x[4],y[4],a[4];
	bool b[100];
	int i,j,k,n;
	cin>>n;
	for(i=0;i<n;i++){
		for(j=0;j<4;j++){
			cin>>x[j]>>y[j];
		}
		a[0]=x[1]-x[0];
		a[1]=y[1]-y[0];
		a[2]=x[3]-x[2];
		a[3]=y[3]-y[2];
		if(a[0]*a[3]==a[1]*a[2]){
			b[i]=true;
		}else{
			b[i]=false;
		}
	}
	for(i=0;i<n;i++){
		if(b[i]){
			s="YES";
		}else{
			s="NO";
		}
		cout<<s<<endl;
	}
	return 0;
}

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

using namespace std;

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

#define EPS (1e-7)

typedef complex<double> P;
struct Line : public vector<P>
{
  Line(P a=P(), P b=P()) {
    push_back(a); push_back(b);
  }
};

double cross(P const& a, P const& b) {
  return imag(conj(a)*b);
}

bool is_parallel(Line const& s, Line const& t) {
  P vs(s[1]-s[0]), vt(t[1]-t[0]);
  return abs(vs.real()/vs.imag() - vt.real()/vt.imag()) < EPS;
}

int main() {
  int N; cin >> N;
  rep(tc, 2) {
    P ps[4]; rep(i, 4) cin >> ps[i].real() >> ps[i].imag();
    cout << (is_parallel(Line(ps[0], ps[1]), Line(ps[2], ps[3])) ? "YES\n" : "NO\n");
  }
}

C++: #include <iostream>

using namespace std;

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

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

int n;
const double EPS = 1e-8;

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