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++: /*
NOTE :
*min_element(.begin(),.end())
*max_element(.begin(),.end())
stack push pop top
queue push pop front
priority_queue<> pq
 push()  pop() size()  top()
map<>
 find() begin() end() insert(map<>::value_type())
pair<>
sort(.begin(), .end())
sort(arr, arr+N)
sort(a, a+N, greater<int>())
binary_search(vc.begin(), vc.end(), x)  //binary_search???true, false?????????
vector<int>::iterator lit = lower_bound(vc.begin(), vc.end(), x);
  lower_bound?????????????????????"??\???"????????????????????????????????????????????¬???????????????
vector<int>::iterator uit = upper_bound(vc.begin(), vc.end(), x);
  upper_bound????????????????????????"?¶???????"?????????????????????????????????????????¬???????????????
*/
#include <iostream>
#include <cstdio>
#include <climits>
#include <cmath>
#include <cassert>
#include <sstream>
#include <algorithm>
#include <valarray>
#include <utility>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <set>

#define MAX 100
#define INF 1<<20
#define LLINF 10e12 // 1<<31 // 2^31
#define REP(i,n) for(int i=0;i<n;i++)
#define REP2(i,a,n) for(int i=(a);i<(n);i++)
#define SET(a,c) memset(a,c,sizeof a)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define FOREACH(i,c) for(auto (i) : (c))
#define BIT(i,j) ((i)>>(j))&1
#define ALL(o) (o).begin(), (o).end()
#define ERASE(o) (o).erase(unique(ALL((o))), (o).end());

using namespace std;
typedef long long ll;
typedef valarray<int> array_t;
/////
double x[4], y[4];
bool solve()
{
  return (fabs((x[1]-x[0])*(y[3]-y[2])-(x[3]-x[2])*(y[1]-y[0]))==0);
}
int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  // FROM HERE
  int n; cin >> n;
  REP(i,n)
  {
    REP(i,4) cin >> x[i] >> y[i];
    printf("%s\n",(solve()?"YES":"NO"));
  }
  return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<string>
using namespace std;
int main() {
	int n;
	cin >> n;
	for (int z = 0; z < n; z++) {
		long float x1, x2, x3,y1, y2, y3, y4, x4 ;
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		if (y1 > y2) {
			swap(y1, y2);
			swap(x1, x2);
		}
		if (y3 > y4) {
			swap(y3, y4);
			swap(x3, x4);
		}
		if ((x1 > x2&&x3 > x4 && ((y2 - y1) / (x1 - x2) == (y4 - y3) / (x3 - x4))) || (x2 > x1&&x4 > x3 && ((y1 - y2) / (x2 - x1) == (y3 - y4) / (x4 - x3)))) {
			cout << "YES" << endl;
		}
		else {
			cout << "NO" << endl;
		}
	}
}

C++: #include <iostream>

using namespace std;

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

C++: #include <iostream>
using namespace std;
double x1,y1,x2,y2;
double a,b,c,d;

double chaji(){
	double dx=x2-x1,dy=y2-y1;
	double aa=c-a,bb=d-b;
	return (dx*bb-dy*aa);
}
int main(){
	int N;cin>>N;
	while(N--){
		cin>>a>>b>>c>>d;
		cin>>x1>>y1>>x2>>y2;
		double ans1=chaji();
		x1=(x1+x2)/2;
		y1=(y1+y2)/2;
		x2=(a+c)/2;
		y2=(b+d)/2;
		if(x2==x1&&y2==y1){x2=a;y2=b;}
		double ans2=chaji();
		if(ans1==0&&ans2!=0)cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
	}
}

C++: #include <iostream> 
#include <complex>

using namespace std;
typedef complex<double> xy_t;  
const double eps = 1e-11;
double cross_product(xy_t a, xy_t b) {
    return (conj(a) * b).imag();
}

int main() {
    int n; // データセット数
    cin >> n;
    double x[4], y[4];
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < 4; j++) {
            cin >> x[j] >> y[j];
        }
        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])) * 0.5 < eps;
        cout << (p ? "YES" : "NO") << endl;
    }
}

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){
        int ans=0;
        double x1,y1,x2,y2,x3,y3,x4,y4,m1,m2;
        cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
        if(x1==x2||x3==x4){
            if(x1==x2&&x3==x4) ans=1;
        }else{
            m1=(y2-y1)/(x2-x1);
            m2=(y4-y3)/(x4-x3);
            if(fabs(m1-m2)==0) ans=1;
        }
        if(ans) cout<<"YES"<<endl;
        else cout<<"NO"<<endl;
    }
}

C++: #include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<string>
#include<map>
#include<set>
#include<unordered_map>
#include<unordered_set>
#include<list>
#include<queue>
#include<stack>
#include<deque>
using namespace std;

int main() {
	int a; cin >> a;
	for (int b = 0; b < a; b++) {
		double x1, y1, x2, y2, x3, y3, x4, y4;
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		double x5 = x2 - x1, y5 = y2 - y1, x6 = x4 - x3, y6 = y4 - y3;
		if (x5 == 0 && x6 == 0 || y5 == 0 && y6 == 0) {
			puts("YES");
		}
		else if (x5 == 0 || x6 == 0 || y5 == 0 || y6 == 0) {
			puts("NO");
		}
		else {
			if (abs(x6 / y6 - x5 / y5) <= 0.0000001)puts("YES");
			else puts("NO");
		}
	}
}

C++: #include<iostream>
#include<cmath>
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;
    if( !(ax-bx) && !(cx-dx) )cout << "YES\n";
    if( abs( (ay-by)/(ax-bx) - (cy-dy)/(cx-dx) ) < 1e-10)cout << "YES\n";
    else cout << "NO\n";
  }
}