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++: #include<iostream>
#include<math.h>
using namespace std;

double abs_(double a)
{
	if (a > 0) return a;
	else return -a;
}

int main(){
	int n;
	cin >> n;
	while (n--){
		double x1, y1, x2, y2, x3, y3, x4, y4;
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		double a = (y2 - y1)*(x4 - x3);
		double b = (y4 - y3)*(x2 - x1);
		if (abs_(a - b) < 0.0000000001){
			cout << "YES" << endl;
		}
		else{
			cout << "NO" << endl;
		}
	}
	return 0;
}

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

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

C++: #include<stdio.h>

int main(void)
{
	double x[4]={0},y[4]={0},x1,x2,y1,y2;
	int i;
	scanf("%d",&i);

	while(i!=0)
	{
		scanf("%f %f %f %f %f %f %f %f",&x[0],&y[0],&x[1],&y[1],&x[2],&y[2],&x[3],&y[3]);
		x1 = x[1]-x[0];   y1 = y[1]-y[0];
		x2 = x[3]-x[2];   y2 = y[3]-y[2];
		if(x1==0 && x2==0)
			printf("YES\n");
		else if(x1==0 || x2==0)
			printf("NO\n");
		else if(y1/x1 == y2/x2)
			printf("YES\n");
		else 
			printf("NO\n");

		i-=1;
	}
 return 0;
}

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

C++: #include <stdio.h>
#include <cctype>
#include <limits.h>
#include <math.h>
#include <complex>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <cstring>
#include <string>
#include <sstream>
#include <algorithm>
#include <iomanip>
#include <iostream>

#define VARIABLE(x) cerr << #x << "=" << x << endl
#define BINARY(x) static_cast<bitset<16> >(x)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define REP(i,m,n) for (int i=m;i<(int)(n);i++)
#define if_range(x, y, w, h) if (0<=(int)(x) && (int)(x)<(int)(w) && 0<=(int)(y) && (int)(y)<(int)(h))
#define ALL(a) (a).begin(),(a).end()
const int INF = 1e9;
const double PI = 3.14159;
int dx[4]={0, 1, 0, -1}, dy[4]={-1, 0, 1, 0};
using namespace std;
typedef long long ll;
//typedef pair<int, int> P;

/* struct P {
	int x, y, n;
	P(int n, int x, int y):n(n), x(x), y(y){}
	P(){}
}; */


/** 幾何ライブラリ **/
// to do : 1183

#include <complex>

#define X real()
#define Y imag()

const double EPS = 1e-8;

typedef double D;
typedef complex<D> P; // Point

// 共役複素数 conj(a);

// 符号
int sig(D a, D b=0) { return a < b - EPS ? -1 : (a > b + EPS ? 1 : 0); }

// 内積
D dot_product(P a, P b) { return (conj(a)*b).real(); }

// 外積
D cross_product(P a, P b) { return (conj(a)*b).imag(); }

/** Problem0021 : Parallelism **/
int main()
{
	int N; cin>>N;
	rep(i, N) {
		P a, b;
		D x1, y1, x2, y2;
		cin>>x1>>y1>>x2>>y2;
		a.X = (x2 - x1);
		a.Y = (y2 - y1);
		
		cin>>x1>>y1>>x2>>y2;
		b.X = (x2 - x1);
		b.Y = (y2 - y1);
		
		if (sig(abs(cross_product(a, b)))==0) {
			cout << "YES" << endl;
		} else {
			cout << "NO" << endl;
		}
	}
}

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

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

}

C++: //
//
//
//
//
//
//

#include <iostream>
#include <complex>

using namespace std;
typedef complex<double> xy_t;

double cross_product(complex<double> a, complex<double> b)
{
  return (conj(a) * b).imag();
}

int main()
{
  int n; //??????????????°
  cin >> n;
  while (n > 0) {
    complex<double> a, b, c, d, e, f;
    double real[4], imag[4];
    for (int i = 0; i < 4; i++)
      cin >> real[i] >> imag[i];
    
    a = xy_t(real[0], imag[0]);
    b = xy_t(real[1], imag[1]);
    c = xy_t(real[2], imag[2]);
    d = xy_t(real[3], imag[3]);
    
    e = a - b;
    f = c - d;
    double judge = cross_product(e, f);
    if (judge < 1e-11)
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
    n--;
  }
}

/*
complex?????????????§????????????§???????????????????????????????????§?????????????????°??¢????????¨???????????????
double????????£??????????????¨????????£???????????????????????¨????°???\?????????????????¶??????????????????????????????
????????????????????¬????¬????????????????????????????
????????\????????????????????????????????????????????¨???????????????
*/

C++: #define _USE_MATH_DEFINES
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<list>
#include<stack>
#include<queue>
#include<cctype>
#include<iomanip>
#include<functional>
using namespace std;
typedef long long llong;
class Point {
public:
	double x, y;
};
int main() {
	int n; cin >> n;
	while (n--) {
		Point a, b, c, d;
		cin >> a.x >> a.y >> b.x >> b.y >> c.x >> c.y >> d.x >> d.y;
		b.x -= a.x; a.x = 0;
		b.y -= a.y; a.y = 0;
		d.x -= c.x; c.x = 0;
		d.y -= c.y; c.y = 0;
		double z = b.x*d.y - b.y*d.x;
		if (z == 0)cout << "YES" << endl;
		else cout << "NO" << endl;
	}
	return 0;
}

C++: #include <iostream>
#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)*(x4-x3) == (x2-x1)*(y4-y3) ){
			cout << "YES" << endl;
		}else{
			cout << "NO" << endl;
		}
	}
}

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