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 <stdio.h>
#include <math.h>


int main(){
	double x1,x2,x3,x4,y1,y2,y3,y4,value1,value2;
	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(x1 == x2 && x3 == x4){
			printf("YES\n");
		}else if(x1 != x2 && x3 == x4){
			printf("NO\n");
		}else if(x1 == x2 && x3 != x4){
			printf("NO\n");
		}else{
			value1 = (y1-y2)/(x1-x2);
			value2 = (x3-x4)/(y3-y4);

			if(abs(value1-value2) < 0.0000001){
				printf("YES\n");
			}else{
				printf("NO\n");
			}
		}
	}
    return 0;
}

C++: #include<iostream>
#include<string.h>
#include<vector>
#include<list>
#include<stdio.h>
#define range(s,n) for(int i = s; i < n; i++)
#define debug(x) cout << "debug " << x << endl;
using namespace std;

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

	cin >> n;
		range(0,n){
			cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
			if(  (y1-y2)/(x1-x2)==(y3-y4)/(x3-x4))
				cout << "YES" << endl;
			else
				cout << "NO" << endl;
		}
	
}

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

int main(){
	int n;
	double x[4], y[4];
	cin >> n;
	while (n--){
		for (int i = 0; i < 4; i++)
			cin >> x[i] >> y[i];
		if ((x[0] - x[1]) / (y[0] - y[1]) == (x[2] - x[3]) / (y[2] - y[3]))
			puts("YES");
		else
			puts("NO");
	}
	return 0;
}

C++: #include <iostream>

using namespace std;
int main(){
  double x1,y1,x2,y2,x3,y3,x4,y4;
  int n; cin>>n;
  while(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 "bits/stdc++.h"
using namespace std;
using ll = long long;
using vi = vector<int>;
using vii = vector<vector<int>>;
using vl = vector<ll>;
using vll = vector<vector<ll>>;
using pii = pair<int,int>;
#define FOR(i,a,b) for(ll i = (a); i < (b); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(obj) (obj).begin(), (obj).end()
#define pb push_back
const double pi = acos(-1);
const double EPS = 1e-10;

double crosss(pair<double,double> c,pair<double,double> d){
  return c.first * d.second - d.first * c.second;
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  vector<pair<double,double>> a(4);
  int n;
  pair<double,double> lineab, linecd;
  cin >> n;
  REP(i,n){
    REP(j,4){
      cin >> a[j].first >> a[j].second;
    }
    lineab.first = a[1].first - a[0].first;
    linecd.first = a[3].first - a[2].first;
    lineab.second = a[1].second - a[0].second;
    linecd.second = a[3].second - a[2].second;
    if (fabs(crosss(lineab,linecd)) < EPS) {
      cout << "YES" << endl;
    } else {
      cout << "NO" << endl;
    }
  }
  
  
  return 0;
}

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

int main(){
  int n;
  double x1, y1, x2, y2, x3, y3, x4, y4;
  cin>>n;
  for(int i=0; i<n; i++){
    bool flag=false;
    cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
    if(x1==x2 && x3==x4){flag=true;}
    else if(x1==x2 || x3==x4){}
    else if(((y2-y1)/(x2-x1))==((y4-y3)/(x4-x3))){flag=true;}
    if(flag) cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
  }
  return 0;
}

C++: #define _USE_MATH_DEFINES
 
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <math.h>

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

	return 0;
}

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

C++: #include<iostream>
#include<cmath>
using namespace std;
#define EPS 1e-10
 
double a,b,c,d,e,f,g,h;
double det(){
    double dx1,dy1,dx2,dy2;
    dx1 = a-c;
    dy1 = b-d;
    dx2 = e-g;
    dy2 = f-h;
    return dx1*dy2 - dy1*dx2;
}
int main(){
    int n;
    cin>>n;
    while(n--){
        cin>>a>>b>>c>>d>>e>>f>>g>>h;
        cout<<(fabs(det())<EPS?"YES":"NO")<<endl;
    }
    return 0;
}

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

int main(){
    int n;
    double x[4], y[4];
    cin >> n;
    for(; n; n--){
        for(int i=0; i<4; i++){
            cin >> x[i] >> y[i];
        }
        if((x[1]-x[2])==0 || (x[3]-x[4])==0){
            if((x[1]-x[2])==0 && (x[3]-x[4])==0){
                cout << "YES" << endl;
            }else{
                cout << "aNO" << endl;
            }
        }else if((y[1]-y[2])/(x[1]-x[2]) == (y[3]-y[4])/(x[3]-x[4])){
            cout << "YES" << endl;
        }else{
            cout << "NO" << endl;
        }
    }
    return 0;
}

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

const double EPS = 1E-15;

inline bool cmp(double x, double y){
  return abs(x-y) < EPS;
}

int main(){
  int n;
  double x1, y1, x2, y2, x3, y3, x4, y4;
  cin>>n;
  for(int i=0; i<n; i++){
    cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
    double s=(x1-x2)*(y1-y2), t=(x3-x4)/(y3-y4);
      if(s==t) 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;
  int dataSets;
  cin >> dataSets;
  for(int i=0;i<dataSets;i++){
    bool flag=false;
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;

    
    if((x2-x1)==0 || (x4-x3)==0){
      if((x2-x1) == (x4-x3)){
	if(x1==x3){
	  flag = true;
	}
      }
    }


    // cout << (y2-y1)/(x2-x1) << endl;
    // cout << (y4-y3)/(x4-x3) << endl;
    if((y2-y1)/(x2-x1) == (y4-y3)/(x4-x3)){
      // cout << "here" << endl;
      flag = true;
    }

    if(flag){
      cout << "YES" << endl;
    }else{
      cout << "NO" << endl;
    }
    
  }

}

C++: #include <stdio.h>

int main(){
	int num;
	double x1, y1;
	double x2, y2;
	double x3, y3;
	double x4, y4;
	double ax, ay;
	double bx, by;
	float s;
				
	scanf("%d", &num);	
	for(int i = 0; i < num; i++){
		scanf("%lf %lf %lf %lf %lf %lf %lf %lf", &x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4);

		ax = x2 - x1;
		ay = y2 - y1;
		bx = x4 - x3;
		by = y4 - y3;
		s = ax*by - ay*bx;
		if(-0.000001 < s && s < 0.000001){
			printf("YES\n");
		}else{
			printf("NO\n");
		}
	}
	
	return 0;
}