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++: #define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <sstream>
#include <utility>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;
#define all(c) (c).begin(), (c).end()
#define loop(i,a,b) for(ll i=a; i<ll(b); i++)
#define rep(i,b) loop(i,0,b)
#define each(e,c) for(auto&e:c)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define lb lower_bound
#define ub upper_bound
#ifdef DEBUG
#define dump(...) (cerr<<#__VA_ARGS__<<" = "<<(DUMP(),__VA_ARGS__).str()<<" ["<<__LINE__<<"]"<<endl)
struct DUMP:ostringstream{template<class T>DUMP &operator,(const T&t){if(this->tellp())*this<<", ";*this<<t;return *this;}};
#else
#define dump(...)
#endif
 
int main(){
    int n; cin>>n;
    rep(_,n){
        ll x[2][2], y[2][2];
        rep(i,2){
            rep(j,2){
                double x_,y_;
                cin >> x_ >> y_;
                x[i][j] = x_;
                y[i][j] = y_;
            }
        }
        ll dx1=x[0][0]-x[0][1], dy1=y[0][0]-y[0][1];
        ll dx2=x[1][0]-x[1][1], dy2=y[1][0]-y[1][1];
        dump(dx1,dx2,dy1,dy2);
        puts(dx1*dy2==dx2*dy1 ? "YES" : "NO");
    }
}

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

int main(){
  int n;
  cin>>n;
  complex<double> a, b, c, d;
  while(n--){
    cin>>a.real()>>a.imag()>>b.real()>>b.imag()>>c.real()>>c.imag()>>d.real()>>d.imag();
    a=a-b;
    c=c-d;
    cout<<(a.real()*c.imag()-a.imag()*c.real()==0?"YES":"NO")<<endl;
  }

  return 0;
}

C++: #include <iostream>
#include <vector>
#include <algorithm>

#define INPUT_FROM_FILE (0) 
#if INPUT_FROM_FILE
#include <fstream>
#endif

int main(int argc, char **argv){
	int n = 0;
	double x1, y1, x2, y2, x3, y3, x4, y4;

#if INPUT_FROM_FILE
	std::ifstream ifs("test.txt");
#endif

//#if INPUT_FROM_FILE
//	ifs >> n;
//#else
//	std::cin >> n;
//#endif
	scanf("%d", &n);

	for(int i = 0; i < n; i++){
#if INPUT_FROM_FILE
		ifs >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
#else
		scanf("%lf %lf %lf %lf %lf %lf %lf %lf",&x1,&y1,&x2,&y2,&x3,&y3,&x4,&y4);
		//std::cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
#endif

		//if(x2 - x1 == 0 && x4 - x3 == 0){
		//	std::cout << "YES" << std::endl;
		//}
		//else if(x2 - x1 == 0 || x4 - x3 == 0){
		//	std::cout << "NO" << std::endl;
		//}
		//else{
		//	double a0 = (y2 - y1) / (x2 - x1);
		//	double a1 = (y4 - y3) / (x4 - x3);

		//	if(a0 == a1){
		//		std::cout << "YES" << std::endl;
		//	}
		//	else{
		//		std::cout << "NO" << std::endl;
		//	}
		//}

		if(fabs((y2 - y1)*(x4 - x3) - (y4 - y3)*(x2 - x1)) < 0.0000000001){
			std::cout << "YES" << std::endl;
		}
		else{
			std::cout << "NO" << std::endl;
		}
	}

	return 0;
}

C++: #include<stdio.h>

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

	scanf("%d",&n);
	for(int x=0;x<n;x++)
	{
		for(;;)
		{
			scanf("%lf %lf %lf %lf %lf %lf %lf %lf",&x1,&y1,&x2,&y2,&x3,&y3,&x4,&y4);
			if(x1>100||y1>100||x2>100||y2>100||x3>100||y3>100||x4>100||y4>100)
			{
			}
			else if(x1<-100||y1<-100||x2<-100||y2<-100||x3<-100||y3<-100||x4<-100||y4<-100)
			{
			}
			else
			{
				break;
			}
		}

		x2-=x1;
		y2-=y1;
		x1=0;
		y1=0;
		x4-=x3;
		y4-=y3;
		x3=0;
		y3=0;

		p=x2/y2;
		q=x4/y4;

		if(p==q)
		{
			printf("YES\n");
		}
		else
		{
			printf("NO\n");
		}
	}
	return 0;
}

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

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

int main() {
  int n = 0;
  double d[8];
  cin >> n;

  for(int i = 0; i < n && 0 <= n && n < 100; i++) {
    for(int j = 0; j < 4*2; j++)
      cin >> d[j];
    double tanAB = (d[3]-d[1])/(d[0]-d[2]);
    double tanCD = (d[7]-d[5])/(d[4]-d[6]);
    if(tanAB == tanCD)
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }

  return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
main(void){
	int T;cin>>T;
	double x1,x2,x3,x4,y1,y2,y3,y4;
	for(int t=1;t<=T;t++){
		cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
		if(x1==x2&&x3==x4)cout<<"No"<<endl;
		if(y1==y2&&y3==y4)cout<<"NO"<<endl;
		else if(abs((x1-x2)*(y3-y4)-(y1-y2)*(x3-x4))<0.0000001)
			cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
	}
}

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

#define FOR(i, a) for(int i=0;i<(int)a;++i)
typedef long long ll;
typedef long double ld;
using namespace std;

void solver() {
    int N;
    cin >> N;
    for (int i = 0; i < N; ++i) {
        ld x1, x2, x3, x4, y1, y2, y3, y4;
        cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
        auto isOK = (y2 - y1) * (x4 - x3) == (y4 - y3) * (x2 - x1);
        if (isOK) {
            cout << "YES" << endl;
        } else {
            cout << "NO" << endl;
        }
    }
}

int main() {
    solver();
    return 0;
}

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


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(fabs((y2 - y1)*(x4 - x3) - (y4 - y3)*(x2 - x1) ) < 0.0000001){ //I copied yutaka watabe's code here
			printf("YES\n");
		}else{
			printf("NO\n");
		}

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

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

int main(){
	int n;cin >> n;
	float a[8];
	float x1, x2, y1, y2, ans;
	while(n--){
		for(int i = 0;i < 8;i++)cin >> a[i];
		y1 = a[3]-a[1];x1 = a[2]-a[0];
		y2 = a[7]-a[5];x2 = a[6]-a[4];
		ans = y1*x2-y2*x1;
		if(ans == 0)cout << "YES" << endl;
		else cout << "NO" << endl;
	}
	return 0; 
}

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

#define EPS 1e-6

int main(){
  int n;cin>>n;
  for(int i=0;i<n;++i){
    double a,b,c,d,e,f,g,h;cin>>a>>b>>c>>d>>e>>f>>g>>h;
    double dx1,dy1,dx2,dy2;
    dx1 = a - c;
    dy1 = b - d;
    dx2 = e - g;
    dy2 = f - h;
    //cout << dx1 << " " << dy1 << " " << dx2 << " "<<dy2<<endl;
    double det = fabs(dx1*dy2 - dx2*dy1);
    (fabs(det)<EPS) ? cout<<"YES"<<endl : cout<<"NO"<<endl;
  }
  return EXIT_SUCCESS;
}