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++: //
//  main.cpp
//  main
//
//  Created by h3037175 on 2018/01/22.
//  Copyright © 2018年 h3037175. All rights reserved.
//

#include<iostream>
#include<stdio.h>
#include<math.h>
#include<string>
#include<algorithm>
#include<utility>
using namespace std;
double zeti(double);
int main() {
    pair<double,double> a;
    pair<double,double> b;
    pair<double,double>c;
    pair<double,double>d;
    int n;
    cin>>n;
    for(int i=0;i<n;++i){
        scanf("%lf%lf%lf%lf%lf%lf%lf%lf",&a.first,&a.second,&b.first,&b.second,&c.first,&c.second,&d.first,&d.second);
        if(a.first==b.first&&c.first==d.first){
            cout<<"YES"<<endl;
            continue;
        }
        double s1,s2;
        s1=(a.second-b.second)/(a.first-b.first);
        s2=(c.second-d.second)/(c.first-d.first);
        if(s1==s2||1/s1==s2){
            cout<<"YES"<<endl;
        }
        else{
            cout<<"NO"<<endl;
        }
    }
    return 0;
}

C++: 
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <cfloat>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <memory>
#include <string>

#include <algorithm>
#include <complex>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <vector>

using namespace std;

#ifdef _MSC_VER
#define __typeof__ decltype
#endif

#define ITER(c)         __typeof__((c).begin())
#define FOREACH(it, c)  for (ITER(c) it=(c).begin(); it != (c).end(); ++it)
#define RITER(c)        __typeof__((c).rbegin())
#define RFOREACH(it, c) for (RITER(c) it=(c).rbegin(); it != (c).rend(); ++it)
#define REP(i, n)       REPEAT(i, 0, n)
#define REPEAT(i, k, n) for (int i = (k); i < (n); ++i)
#define REVREP(i, n)    for (int i = ((n)-1); i >= 0; --i)
#define FIND(c, n)      std::find((c).begin(), (c).end(), (n));
#define BSEARCH(c, n)   std::binary_search((c).begin(), (c).end(), (n))
#define LLPOW(p1,p2)    ((ll)pow((double)(p1), (int)p2))
#define ESIZEOF(A)      (sizeof(A)/sizeof((A)[0]))
#define MIN(p1,p2)      (((p1)<(p2))?(p1):(p2))
#define MAX(p1,p2)      (((p1)>(p2))?(p1):(p2))
#define CIN_NO_SYNC     do { cin.tie(0); ios_base::sync_with_stdio(false); } while(0)
#define GETSTR(p)       fgets((p), sizeof(p), stdin)
#define CHOMP(p)        do{ char *_q = (p) + strlen(p)-1; if(*_q == '\n') *_q = 0; } while(0)

#define X real()
#define Y imag()
typedef double D;
typedef complex<double>P;
#define EPS (1e-9)

bool iscross(P &p1, P &p2, P &p3, P &p4){
    double f1 = p2.X - p1.X;
    double g1 = p2.Y - p1.Y;
    double f2 = p4.X - p3.X;
    double g2 = p4.Y - p3.Y;
    double det = f2 * g1 - f1 * g2;
    if(abs(det) < EPS) return false;
    return true;
}

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;
        P p1(x1,y1), p2(x2,y2), p3(x3,y3), p4(x4,y4);
        if(!iscross(p1,p2,p3,p4)){
            cout << "YES" << endl;
        } else {
            cout << "NO" << endl;
        }
    }
    return 0;
}

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

using namespace std;

int main()
{
	double x1,x2,x3,x4,y1,y2,y3,y4,rad1,rad2;
	int n,i;
	
	cin >> n ;
	
	for(i=0;i<n;i++)
	{
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4 ;
		
		if(y2!=y1)
			rad1=atan((x2-x1)/(y2-y1));
		else
			rad1=100000000.0;
		if(y3!=y4)
			rad2=atan((x4-x3)/(y4-y3));
		else
			rad2=100000000.0;
		
		if(rad1==rad2)
			cout << "YES" << endl;
		else
			cout << "NO" << endl;
	}
}

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

C++: #include<cstdio>

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

C++: #include <iostream>

using namespace std;
 
int main(){
  double a,b,c,d,e,f,g,h;
  int t;
  
  cin >> t;
  while(t--){
    cin >> a >> b >> c >> d >> e >> f >> g >> h;
    if((d-b)/(c-a) == (h-f)/(g-e)){
      cout << "YES" << endl;
    }else{
      cout << "NO" << endl;
    }
  }
 
  return 0;
}

C++: #include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <climits>

using namespace std;

double EPS = 1e-12;

//誤差を考慮して足し算を行う
double add(double a, double b) {
	if( abs(a + b) < EPS * (abs(a) + abs(b))) {
		return 0;
	}

	return a + b;
}

//二次元ベクトル構造体
struct P {
	double x, y;

	P() {}
	P(double x, double y) : x(x), y(y) {
	}
	P operator + (P p) {
		return P(add(x, p.x), add(y, p.y));
	}
	P operator - (P p) {
		return P(add(x, -p.x), add(y, -p.y));
	}
	P operator * (double d) {
		return P(x * d, y * d);
	}
	double dot(P p) {	//　内積
		return add(x * p.x, y * p.y);
	}
	double det(P p) {	//　外積
		return add(x * p.x, -y * p.y);
	}
};

//　線分p1-p2上に点qがあるか判定
bool on_seg(P p1, P p2, P q) {
		return (p1 - q).det(p2 - q) == 0 && (p1 - q).dot(p2 - q) <= 0;
}

//　直線p1-p2と直線q1-q2の交点
P intersection(P p1, P p2, P q1, P q2) {
	return p1 + (p2 - p1) * ((q2 - q1).det(q1 - p1) / (q2 - q1).det(p2 - p1));
}


int main() {
	int n;

	cin >> n;

	P p, q, r, s;

	for(int i = 0; i < n; i++) {
		cin >> p.x >> p.y >> q.x >> q.y >> r.x >> r.y >> s.x >> s.y;
		if( (q - p).det(s - r) == 0) {
			cout << "YES" << endl;
		} else {
			cout << "NO" << endl;
		}
	}

}

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

int main(){
  double a,b,c,d,e,f,g,h,m[4];
  int s;
  cin>>s;
  for(int j=0;j<s;j++){
    cin>>a>>b>>c>>d>>e>>f>>g>>h;
    m[0]=c-a;
    m[1]=g-e;
    m[2]=d-b;
    m[3]=h-f;
    if(m[2]*m[0]==m[3]*m[1])cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
  }
  return 0;
}

C++: #include <stdio.h>
 
struct point {
    double x;
    double y;
};
 
int main(void) 
{
    int i, n;
    struct point A, B, C, D;
    double slope_AB, slope_CD;
 
    scanf("%d", &n);
 
    for (i = 0; i < n; i++) {
        scanf("%lf %lf %lf %lf %lf %lf %lf %lf", &A.x, &A.y, &B.x, &B.y, &C.x, &C.y, &D.x, &D.y);
 
        slope_AB = (A.y - B.y) / (A.x - B.x);
        slope_CD = (C.y - D.y) / (C.x - D.x);
 
        if (slope_AB == slope_CD) {
            printf("YES\n");
        } else {
            printf("NO\n");
        }
    }
    return 0;
}