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[1] == fpoints[3] {
			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 <vector>
#include <algorithm>
#include <map>
#include <math.h>
#include <complex>
using namespace std;
#define rep(i,n) for (int i=0; i < (n); i++)

// 主に以下の資料を参考に作成した。
// - http://www.prefield.com/algorithm
// - http://www.deqnotes.net/acmicpc/2d_geometry/
// - https://github.com/infnty/acm/tree/master/lib/geometry
// - サークルの先輩が作ったライブラリ

/* 基本要素 */

typedef double D;      // 座標値の型。doubleかlong doubleを想定
typedef complex<D> P;  // Point
typedef pair<P, P> L;  // Line
typedef vector<P> VP;
const D EPS = 1e-9;    // 許容誤差。問題によって変える
#define X real()
#define Y imag()
#define LE(n,m) ((n) < (m) + EPS)
#define GE(n,m) ((n) + EPS > (m))
#define EQ(n,m) (abs((n)-(m)) < EPS)

// 内積　dot(a,b) = |a||b|cosθ
D dot(P a, P b) {
  return (conj(a)*b).X;
}
// 外積　cross(a,b) = |a||b|sinθ
D cross(P a, P b) {
  return (conj(a)*b).Y;
}

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;
    P a = P(x1, y1);
    P b = P(x2, y2);
    P c = P(x3, y3);
    P d = P(x4, y4);
    
    if (EQ(cross(a-b, c-d), 0)) {
      std::cout << "YES" << std::endl;
    }else {
      std::cout << "NO" << std::endl;
    }
  }

  
  return 0;
}

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

C++: #include <bits/stdc++.h>
using namespace std;

int main(){
  int n;cin>>n;
  for(int i=0;i<n;++i){
    vector<pair<double, double>> coordinates;
    for(int j=0;j<4;++j){
      double a,b;cin>>a>>b;
      coordinates.emplace_back(make_pair(a,b));
    }
    int tan1,tan2;
    tan1 =10000*fabs((coordinates[2].second-coordinates[1].second)/(coordinates[2].first-coordinates[1].first));
    tan2 =10000*fabs((coordinates[4].second-coordinates[3].second)/(coordinates[4].first-coordinates[3].first));
   // cout<<tan1<<" "<<tan2<<endl;
    tan1 == tan2 ? cout<<"YES"<<endl : cout<<"NO"<<endl;
  }
  return EXIT_SUCCESS;
}

C++: 
#include<cstdio>
#include<cstdlib>
#include<cmath>
 
using namespace std;
int main(void)
{
    int n;
    double x[4],y[4];
    double k[2];
    scanf("%d",&n);
    for(int i = 0;i < n;i++)
    {
        for(int j = 0;j < 4;j++) scanf("%lf%lf",&x[j],&y[j]);
        k[0] = (y[0]-y[1])/(x[0]-x[1]);
        k[1] = (y[2]-y[3])/(x[2]-x[3]);
        if(k[0] == k[1]) printf("YES\n");
        else printf("NO\n");
    }
    return 0;
}

C++: #include <stdio.h>
#include<cmath>
using namespace std;

int main(){
	double x1,x2,x3,x4,y1,y2,y3,y4;
	int n;
	scanf("%d",&n);
	for(int i=0; i<n; i++){
		scanf("%lf %lf %lf %lf %lf %lf %lf %lf",&x1,&y1,&x2,&y2,&x3,&y3,&x4,&y4);

		if(abs((y2 - y1)*(x4 - x3) - (y4 - y3)*(x2 - x1) ) < 0.0000000001){ //I copied yutaka watabe's code here
			printf("YES\n");
		}else{
			printf("NO\n");
		}

	}
    return 0;
}

C++: #include <stdio.h>
#include <math.h>

const double eps = 1e-7;

int n;
//math.hライブラリでy1, y2...とかって変数名が使われてるらしい
double ix1, ix2, ix3, ix4;
double iy1, iy2, iy3, iy4;

//増加率を見る方法
int solve1() {
    double r1 = (iy2-iy1)/(ix2-ix1);
    double r2 = (iy4-iy3)/(ix4-ix3);
    return (fabs(r1-r2) < eps);
}

int main() {
    scanf("%d", &n);
    for(int i=0; i<n; ++i) {
        scanf("%lf %lf %lf %lf %lf %lf %lf %lf", &ix1, &iy1, &ix2, &iy2, &ix3, &iy3, &ix4, &iy4);
        if(solve1()) {
            printf("YES\n");
        } else {
            printf("NO\n");
        }
    }
}

C++: #include <iostream>

using namespace std;

int main()
{
	double x1, y1, x2, y2, x3, y3, x4, y4;
	int N;
	cin >> N;
	
	for (int i=0; i<N; i++) {
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		
		if ( ( (x1==x2) && (y1==y2) ) || ( (x3==x4) && (y3==y4) ) ) {
			cout << "NO" << endl;
			continue;
		}
		
		double LHS = (100000.0 * (y2 - y1)) * (x4 - x3);
		double RHS = (100000.0 * (y4 - y3)) * (x2 - x1);
		//cout << LHS << " " << RHS << endl;
		//if ( (y2 - y1) * (x4 - x3) == (y4 - y3) * (x2 - x1) ) cout << "YES" << endl;
		if ( LHS == RHS ) cout << "YES" << endl;
		else cout << "NO" << endl;
	}
		
	return 0;
}

C++: #include<iostream>
#include<algorithm>
using namespace std;
 
int main(){
 
  double ax,ay,bx,by,cx,cy,dx,dy;
  double n,s,t;
 
  cin >> n;
 
  for(int i=0;i<n;i++){
    cin >> ax >> ay >> bx >> by >> cx >> cy >> dx >> dy;
 
    s = (ay - by) / (ax - bx);
    t = (cy - dy) / (cx - dx);
 
    if(s == t) cout << "YES" << endl;
    else cout << "NO" << endl;
 
  }
}

C++: #include <iostream>

int main() {
    int n;
    std::cin >> n;
    double x1,y1,x2,y2,x3,y3,x4,y4;
    
    for(int i = 0;i < n;i++){
        std::cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
        double a = (y1-y2)/(x1-x2);
        double b = (y3-y4)/(x3-x4);
         std::cout <<  (a==b ? "YES":"NO") << '\n';
    }
}

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

using namespace std;

#define EQ(x, y) (abs(x - y) < 0.000001)

int main() {
  int n; 
  cin >> n;

  double cx[4], cy[4];
  for (int i = 0 ; i < n; ++i) {
    for (int j = 0; j < 4; j++)
      cin >> cx[j] >> cy[j];
    
    if (EQ(cx[1], cy[0]) && EQ(cx[3], cx[2])) {
      if (EQ(cy[1], cy[0]) || EQ(cy[3], cy[2])) {
        cout << "YES" << endl;
      } else {
        cout << "NO" << endl;
      }
    } else if (EQ(cx[1], cx[0]) || EQ(cx[3], cx[2])) {
      cout << "NO" << endl;
    } else if (!EQ(cx[1], cx[0]) && !EQ(cx[3], cx[2])) {
      double k1 = (cy[1] - cy[0]) / (cx[1] - cx[0]);
      double k2 = (cy[3] - cy[2]) / (cx[3] - cx[2]);
      if (EQ(k1, k2)) {
        cout << "YES" << endl;
      } else {
        cout << "NO" << endl;
      }
    }
  }
}

C++: #include<iostream>
using namespace std;
int main(){
  double a[2],b[2],c[2],d[2];
  int n;
  cin >> n;
  for(int i=0;i<n;i++){
    cin >> a[0] >> a[1] >> b[0] >> b[1] >> c[0] >> c[1] >> d[0] >> d[1];
    //if(a[0]-b[0]==0&&c[0]-d[0]==0) cout << "YES" << endl;
    //else if(a[1]-b[1]==0&&c[1]-d[1]==0) cout << "YES" << endl;
    //else if(a[0]-b[0]==0||c[0]-d[0]==0) cout << "NO" << endl;
    if((b[1]-a[1])*(d[0]-c[0])==(d[1]-c[1])*(b[0]-a[0])) cout << "YES" << endl;
    else cout << "NO" << endl;
  }   
  return 0;
}

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

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

  cin >> n;

  for( int i = 0 ; i < n ; i++ ){

    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;
}