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 <cmath>

using namespace std;

void swap(double &x, double &y, double &xx, double &yy) 
{
  double tmp_x = x;
  double tmp_y = y;
  x = xx;
  y = yy;
  xx = tmp_x;
  yy = tmp_y;
}

bool isZero(double x) 
{
  return x < 0.000000001;
}

void compute(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4) 
{
  if (x1 > x2)
    swap(x1, y1, x2, y2);
  else if (x1 == x2 && y1 > y2)
    swap(x1, y1, x2, y2);
  if (x3 > x4)
    swap(x3, y3, x4, y4);
  else if (x3 == x4 && y3 > y4)
    swap(x3, y3, x4, y4);

  double diff_x12 = x2 - x1;
  double diff_y12 = y2 - y1;
  double diff_x34 = x4 - x3;
  double diff_y34 = y4 - y3;

  // if (isZero(diff_x12) && isZero(diff_y12))
  //   cout << "NO" << endl;
  // else if (isZero(diff_x34) && isZero(diff_y34))
  //   cout << "NO" << endl;  
 if (!isZero(diff_x12) && !isZero(diff_x34)) {
    double ab = diff_y12 / diff_x12;
    double cd = diff_y34 / diff_x34;
    if (isZero(abs(ab - cd)))
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }
  else if (isZero(diff_x12) && isZero(diff_x34)) 
    cout << "YES" << endl;  
  else
    cout << "NO" << endl;  
}

int main(void) 
{
  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;

    //cout << x1 << " " << y1 << " " << x2 << " " << y2 << " " << x3 << " " << y3 << " " << x4 << " " << y4;
    

    compute(x1, y1, x2, y2, x3, y3, x4, y4);
  }
  
  return 0;
}

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

int main(int argc, char const* argv[]) {
  int n;
  cin >> n;
  for (int i = 0; i < n; i += 1) {
    float x1, y1, x2, y2, x3, y3, x4, y4;
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
    float AB, CD;
    AB = (y2 - y1) / (x2 - x1);
    CD = (y4 - y3) / (x4 - x3);
    if (AB == CD) cout << "YES" << endl;
    else cout << "NO" << endl;
  }
  return 0;
}

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) * (x4-x3);
    b = (y4-y3) * (x2-x1);
    a == b ? cout << "YES" << endl : cout << "NO" << endl;
  }
  return 0;
}

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]))<10e-7);
}
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 <stdio.h>
int main(void){
    int b[100],n;
    double a[100],c[100];
        scanf("%d",&n);
        for(b[2]=1;b[2]<=n;b[2]++){
            for(b[3]=1;b[3]<=8;b[3]++){
                scanf("%lf",&a[b[3]+10*n]);
            }
        }


for(b[2]=1;b[2]<=n;b[2]++){
        c[0]*1.0=a[6+10*n]/a[7+10*n]*1.0;
        c[1]*1.0=a[2+10*n]/a[3+10*n]*1.0;
        if(c[0]==c[1]){
            printf("YES\n");
        }
        else printf("NO\n");
            }




    return 0;
}

C++: #include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <functional>
#include <string>
#include <algorithm>
#include <climits>
#include <utility>

#define PRINT(STR) cout << STR << endl;
#define REP(i, n) for (int (i) = 0; (i) < (int)(n); (i)++)
#define REG(i, a, b) for (int (i) = ((int)(a)); (i) < ((int)(b)); i++)
#define ALL(V) (V).begin(), (V).end()

typedef long long ll;

using namespace std;

int nextInt() { int n = -1; cin >> n; return n; }
double nextDouble() { double d = -1; cin >> d; return d; }
ll nextll() { ll n = -1; cin >> n; return n; }
string nextString() { string str; cin >> str; return str; }

int INF = 9999999;

// BEGIN //////////////////////////////////////////////////////////////


int main() {
	int N = nextInt();
	REP(i, N) {
		double x1 = nextDouble();
		double y1 = nextDouble();
		double x2 = nextDouble();
		double y2 = nextDouble();
		double x3 = nextDouble();
		double y3 = nextDouble();
		double x4 = nextDouble();
		double y4 = nextDouble();
		if (x1 > x2) {
			double t = x2;
			x2 = x1; x1 = t;
			t = y2; y2 = y1; y1 = t;
		}
		if (x3 > x4) {
			double t = x4;
			x4 = x3; x3 = t;
			t = y4; y4 = y3; y3 = t;
		}
		if ((y2 - y1) / (x2 - x1) == (y4 - y3) / (x4 - x3)) {
			PRINT("YES");
		} else {
			PRINT("NO");
		}
	}

	return 0;
}

// END   //////////////////////////////////////////////////////////////

C++: #include <iostream>
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,ll,lll;
        cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
        ll = (y2-y1)/(x2-x1);
        lll = (y4-y3)/(x4-x3);
        cout << ((ll == lll)? "YES" : "NO") << endl;
    }
}

C++: #include <cstdio>

int main(int argc, char *argv[]) {
	int dataN;
	scanf("%d", &dataN);
	for (int i = 0; i < dataN; i++) {
		float x1, y1, x2, y2, x3, y3, x4, y4;
		scanf("%f %f %f %f %f %f %f %f", &x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4);
		
		float res1 = 1.0f, res2 = 2.0f;
		bool flg1 = false, flg2 = false;
		
		if (x2 > x1) res1 = (y2-y1)/(x2-x1);
		else if (x2 == x1) flg1 = true;
		else res1 = (y1-y2)/(x1-x2);
		if (res1 == 0.0f) flg1 = true;
		
		if (x4 > x3) res2 = (y4-y3)/(x4-x3);
		else if (x4 == x3) flg2 = true;
		else res2 = (y3-y4)/(x3-x4);
		if (res2 == 0.0f) flg2 = true;
		
		if (res1 == res2) {
			puts("YES");
		}
		else {
			if (flg1 && flg2) puts("YES");
			else puts("NO");
		}
	}
	return 0;
}