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")
		} else {
			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 <complex>

using namespace std;
typedef complex<double> P;

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

int main(){
  int n;
  cin >> n;
  while(n--){
    P p[4];
    for(int i=0; i<4; i++)
      cin >> p[i].real() >> p[i].imag();
    if(cross(p[1]-p[0],p[3]-p[2])<1e-10)
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }
  
}

C++: #include<iostream>
#include<string>
#include<vector>
#include<cstdio>
#include<sstream>
#include<algorithm>
#include<cmath>
#include<map>
#include<functional>
#include<queue>
#include<stack>
#include<set>
#include<math.h>
using namespace std;
#define SZ(n)  (int)n.size()
#define dump(x) cerr<<#x<<" = "<<(x)<<endl;
#define debug(x)cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define MP make_pair
#define PB push_back
	double EPS=1e-10;
	bool same(double a,double b){
		if(fabs(a-b)<=EPS)return 1;
		else return 0;
	}
	
	
	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 a1=(y2-y1)/(x2-x1);
		double a2=(y4-y3)/(x4-x3);
		if(same(a1,a2))cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
	}
	
	return 0;
}

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

using namespace std;

#define FOR(i, j, k) for(int i = j; i < k; ++i)
#define rep(i, j) FOR(i, 0, j)
#define repr(i, j) for(int i = j; i >= 0; --i)
#define INF (1 << 30)
#define MOD 1e9 + 7

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;

int main() {
	int N;
	scanf("%d", &N);
	rep(i, N) {
		double x1, y1, x2, y2, x3, y3, x4, y4;
		scanf("%lf %lf %lf %lf %lf %lf %lf %lf", &x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4);
		double AB = (y2 - y1) / (x2 - x1);
		double CD = (y4 - y3) / (x4 - x3);
		printf("%s\n", (AB == CD) ? "YES" : "NO");
	}
	return 0;
}

C++: #include <iostream>

using namespace std;

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

  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> x1 >> y1 >> x2 >> y2
        >> x3 >> y3 >> x4 >> y4;

    ang_ab = (y1 - y2) / (x1 - x2);
    ang_cd = (y3 - y4) / (x3 - x4);

		if (ang_ab == ang_cd) {
      cout << "YES" << endl;
    } else {
      cout << "NO"  << endl;
    }
  }

  return 0;
}

C++: #include<stdio.h>

int main(){
	int n;
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		double x1,y1,x2,y2,x3,y3,x4,y4;
		scanf("%lf %lf %lf %lf %lf %lf %lf %lf",&x1,&y1,&x2,&y2,&x3,&y3,&x4,&y4);
		if((y2-y1)*(x4-x3)==(y4-y3)*(x2-x1))printf("YES\n");
		else printf("NO\n");
	}
	return 0;
}

C++: #include <iostream>
using namespace std;
#define REP(i, n)       REPEAT(i, 0, n)
#define REPEAT(i, k, n) for (int i = (k); i < (n); ++i)

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;
        if((y2-y1)/(x2-x1) == (y4-y3)/(x4-x3)){
            cout << "YES" << endl;
        } else {
            cout << "NO" << endl;
        }
    }
    return 0;
}

C++: #include <iostream>
#include <stdio.h>
#define REP(i,n) for(int i = 0; i < (n); ++i)
using namespace std;

int main(){
	int n;
	cin >> n;
	double x1,y1,x2,y2,x3,y3,x4,y4;
	REP(i,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;
		}
	}
	return 0;
}

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