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 "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-8;

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

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 (abs(cross(lineab,linecd)) < EPS) {
      cout << "YES" << endl;
    } else {
      cout << "NO" << endl;
    }
  }
  
  
  return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
  int n;
  double xa,ya,xb,yb,xc,yc,xd,yd,a2,a1;
  while(1){
    cin>>n;
    for(int i=0;i<n;i++){
      cin>>xa>>ya>>xb>>yb>>xc>>yc>>xd>>yd;
      a1=(yb-ya)/(xb-xa);
      a2=(yd-yc)/(xd-xc);
      if(a1==a2)cout<<"YES"<<endl;
      else cout<<"NO"<<endl;
    }
  }
  return 0;
}

C++: #include<stdio.h>
#include<string.h>
#include<iostream>

using namespace std;
double cross(long double x1,long double y1,long double x2,long double y2);

int main(){
	long double x1,y1,x2,y2;
	long double x3,y3,x4,y4;
	long double ans1,ans2;
	int n;
	cin>>n;
	for(int i=0;i<n;i++){
	cin>>x1>>y1>>x2>>y2;
	cin>>x3>>y3>>x4>>y4;
	ans1=cross(x1,y1,x2,y2);
	ans2=cross(x3,y3,x4,y4);
	//cout<<ans1<<" "<<ans2<<endl;
	if(ans1==ans2)
		cout<<"YES"<<endl;
	else 
		cout<<"NO"<<endl;
	}
}


double cross(long double x1,long double y1,long double x2,long double y2){
	return (x1-x2)/(y1-y2);
}

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

C++: #include <iostream>

using namespace std;
int main(void){
    // Here your code !
int n;
double x1,x2,x3,x4,y1,y2,y3,y4;
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;
}
}

C++: #include<iostream>

using namespace std;


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

C++: #define _USE_MATH_DEFINES
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<cctype>
#include<cmath>
#include<cstdio>
#include<deque>
#include<list>
#include<set>
#include<stack>
#include<string>
#include<sstream>
#include<map>
#include<queue>
#include<vector>
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;
		double ABx = x2 - x1,
			ABy = y2 - y1,
			CDx = x4 - x3,
			CDy = y4 - y3;
		if (abs(ABx / ABy) == abs(CDx / CDy))cout << "YES" << endl;
		else cout << "NO" << endl;
	}
	return 0;
}

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

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

C++: #include <iostream>

using namespace std;

int main() {
	double x[4], y[4];
	double ab, cd;
	int n;

	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> x[0] >> y[0] >> x[1] >> y[1] >> x[2] >> y[2] >> x[3] >> y[3];
		if (x[0] < x[1]) {
			swap(x[0], x[1]);
			swap(y[0], y[1]);
		}
		if (x[2] < x[3]) {
			swap(x[2], x[3]);
			swap(y[2], y[3]);
		}
		ab = cd = 999999;
		if (x[0] != x[1])
			ab = (y[0] - y[1]) / (x[0] - x[1]);
		if (x[2] != x[3])
			cd = (y[2] - y[3]) / (x[2] - x[3]);
		if (ab == cd)
			cout << "YES" << endl;
		else
			cout << "NO" << endl;
	}
	return 0;
}

C++: #include <stdio.h>

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

	int i;


	scanf("%d", &n);

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

		if((x2 - x1) * (y4 - y3) - (y2 - y1) * (x4 - x3))
			printf("NO\n");
		else
			printf("YES\n");
	}

	return 0;
}

C++: #include<stdio.h>
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <iterator>
#include <list>
#include <map>     
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <iomanip>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define ll long long
#define ld long double
#define rep(a,t) for(int a=0;a<t;a++) 
#define forever while(true)
#define Sort(a) sort(a.begin(),a.end())
#define Reverse(a) reverse(a.begin(),a.end())
#define pb push_back
int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	ld x1, y1, x2, y2, x3, y3, x4, y4;
	rep(i, n) {
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		if (x1 == x2 || x3 == x4) { if (x1 == x2 && x3 == x4) { cout << "YES" << endl; } else { cout << "NO" << endl; } continue; }
		ld katamuki[2];
		katamuki[0] = (y2 - y1) / (ld)(x2 - x1);
		katamuki[1] = (y4 - y3) / (ld)(x4 - x3);
		if (katamuki[0] == katamuki[1]) { cout << "YES" << endl; }
		else { cout << "NO" << endl; }
	}
	return 0;
}