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>
using namespace std;

int main(void)
{
    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 ((x2-x1)==0 && (x4-x3)==0)
            cout << "YES" << endl;
        else
            cout << (((y2-y1)/(x2-x1)==(y4-y3)/(x4-x3))? "YES" : "NO") << endl;
    }
    return 0;
}

C++: #include <cstdio>
#include <iostream>

using namespace std;

int main( ) {
	int i, n;
	double x[4][100], y[4][100];
	double slope1[100], slope2[100];

	scanf("%d", &n);
	for (i = 0; i < n; i++) {
		for (int j = 0; j < 4; j++) {
			scanf("%lf %lf", &x[j][i], &y[j][i]);
			slope1[i] = (y[1][i] - y[0][i]) / (x[1][i] - x[0][i]);
			slope2[i] = (y[3][i] - y[2][i]) / (x[3][i] - x[2][i]);
		}
	}

	for (i = 0; i < n; i++) {
		if (slope1[i] == slope2[i]) {
			printf("YES\n");
		}
		else {
			printf("NO\n");
		}
	}
	
	return 0;
}

C++: #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++){
      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++: // includes
#include <cstdio>
#include <cstdint>
#include <iostream>
#include <iomanip>
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <utility>
#include <functional>
#include <cmath>
#include <climits>
#include <bitset>

// macros
#define ll long long int
#define pb push_back
#define mk make_pair
#define pq priority_queue
#define FOR(i, a, b) for(int i=(a); i<(b);++i)
#define rep(i, n) FOR(i, 0, n)

using namespace std;

//  types
typedef pair<int, int> P;
typedef pair<ll, int> Pl;
typedef pair<ll, ll> Pll;
 
// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double EPS = 1e-10;

// solve

int main(int argc, char const* argv[])
{
  int n;
  cin >> n;
  rep(j, n){
    double x[4], y[4];
    rep(i, 4){
      cin >> x[i] >> y[i];
    }
    if(abs((x[1] - x[0]) * (y[3] - y[2]) - (x[3] - x[2]) * (y[1] - y[0])) < EPS){
      cout << "YES" << endl;
    }else{
      cout << "NO" << endl;
    }
  }
	return 0;
}

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

int main()
{
	int n ;
	double ax,ay,bx,by,cx,cy,dx,dy ;

	cin >> n ;
	for( int i = 0 ; i < n ; i ++ )
	{
		cin >> ax >> ay >> bx >> by >> cx >> cy >> dx >> dy ;

		double a = (ay-by)/(ax-bx) ;
		double b = (cy-dy)/(cx-dx) ;

		if( a == b )
		{
			cout << "YES" << endl ;
		}
		else
		{
			cout << "NO" << endl ;
		}
	}
	return 0 ;
}

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

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]||x[2]==x[3]){
      if(x[0]==x[1]&&x[2]==x[3]) cout << "YES" << endl;
      else cout << "NO" << endl;
      continue;
    }
    
    double a,b;
    a = (y[0]-y[1])/(x[0]-x[1]);
    b = (y[2]-y[3])/(x[2]-x[3]);
    
    if(a == b) cout << "YES" << endl;
    else cout << "NO" << endl;
  }
  
  return(0);
}

C++: #include<iostream>
using namespace std;
int main()
{
	int n;cin>>n;
	for(;n--;)
	{
		double a,b,c,d,e,f,g,h;cin>>a>>b>>c>>d>>e>>f>>g>>h;
		cout<<((d-b)*(g-e)==(h-f)*(c-a)?"YES":"NO")<<endl;
	}
}

C++: #include <stdio.h>
#define sqr(a) (a) * (a)

int main(void){
	int n, i;
	double x1,x2,x3,x4,y1,y2,y3,y4;
	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);
		double left = (sqr(x2 - x1) + sqr(y2 - y1)) * (sqr(x4 - x3) + sqr(y4 - y3));
		double right = sqr((x2 - x1) * (x4 - x3) + (y2 - y1) * (y4 - y3));
		if(left == right || -left == right){
			printf("YES\n");
		}else{
			printf("NO\n");
		}
	}
	return 0;
}

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

typedef struct {
  double x;
  double y;
} point;

int main() {
  point a, b, c, d;
  int n;
  cin >> n;
  while (n--) {
    cin >> a.x >> a.y >> b.x >> b.y >> c.x >> c.y >> d.x >> d.y;
    point p, q;
    p.x = b.x - a.x;
    p.y = b.y - a.y;
    q.x = d.x - c.x;
    q.y = d.y - c.y;

    if (-0.00001 < p.x * q.y - p.y * q.x && p.x * q.y - p.y * q.x < 0.00001)
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }
  return 0;
}

C++: #include<iostream>
#include<complex>
#include<cmath>
using namespace std;
typedef complex<double> xy;

int main() {
	int n;
	xy a, b, c, d;
	double delta = 0.00001;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a.real() >> a.imag();
		cin >> b.real() >> b.imag();
		cin >> c.real() >> c.imag();
		cin >> d.real() >> d.imag();

		xy s = a - b, t = c - d;
		if (abs((conj(s)*t).imag()) < delta) 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++){
    cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
    if((x1-x3)==0 && (x2-x4)==0) cout<<"YES"<<endl;
    else if((y1-y3)/(x1-x3)==(y2-y4)/(x2-x4)) cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
  }

  return 0;
}

C++: #include <iostream>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <string>
#include <math.h>
#include <functional>
#include <algorithm>

typedef long long Int;
#define REP(i,n) for(int i = 0 ; i < n ; ++i)
using namespace std;

int main(){
	double p[8];
	int n;
	cin >> n;

	REP(i, n){

		REP(i, 8){
			cin >> p[i];
		}

		string ans = (p[3] - p[1]) / (p[2] - p[0]) == (p[7] - p[5]) / (p[6] - p[4]) ? "YES" : "NO";


		cout << ans << endl;
	}
	return 0;
}

C++: #include<iostream>
using namespace std;
int main() {
	double zhyoxy[4], line1, line2;
	int time;
	cin >> time;
	for (int i = 0; i < time; ++i) {
		for (int i = 0; i < 4; ++i) {
			cin >> zhyoxy[i];
		}
		line1 = (zhyoxy[3] - zhyoxy[1]) / (zhyoxy[2] - zhyoxy[0]);
		for (int i = 0; i < 4; ++i) {
			cin >> zhyoxy[i];
		}
		line2 = (zhyoxy[3] - zhyoxy[1]) / (zhyoxy[2] - zhyoxy[0]);
		if (line1 == line2) {
			cout << "YES" << endl;
		}
		else {
			cout << "NO" << endl;
		}
	}
	return 0;
}

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

int main(){
	double x1,y1,x2,y2,x3,y3,x4,y4;
	double AB,CD;
	int n;
	cin>>n;
	while(n--){
		cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;

		AB = (y1-y2)/(x1-x2);
		CD = (y3-y4)/(x3-x4);
		if(AB == CD)
			cout<<"YES"<<endl;

		else
			cout<<"NO"<<endl;
	}
	return 0;
}