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

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;
    long long int xx1,yy1,xx2,yy2,xx3,yy3,xx4,yy4;
    xx1 = x1*100000;
    yy1 = y1*100000;
    xx2 = x2*100000;
    yy2 = y2*100000;
    xx3 = x3*100000;
    yy3 = y3*100000;
    xx4 = x4*100000;
    yy4 = y4*100000;
    
    xx4 = xx4 - xx3 + xx1;
    yy4 = yy4 - yy3 + yy1;

    if(xx2 == xx4 && yy2 == yy4){
      cout<<"YES"<<endl;
    }
    else{
      cout<<"NO"<<endl;
    }


  }
  return 0;
}

C++: #include<iostream>
#include<cmath>
using namespace std;
int main() {
  int n;
  cin>>n;
  double x1,x2,x3,x4,y1,y2,y3,y4;
  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\n";
    else
      cout<<"NO\n";
  }
  return 0;
}

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

int main(){
    int n;
    cin >> n;
    while(n--){
        double x1,y1,x2,y2,x3,y3,x4,y4,ll,lll;
        cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
        ll = (y1-y2)/(x1-x2);
        lll = (y4-y3)/(x4-x3);
        cout << ((ll == lll)? "YES" : "NO") << endl;
    }
}

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

int main() {
	double x1, y1, x2, y2, x3, y3, x4, y4;
	int n;
	double veku1[2];
	double veku2[2];
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		veku1[0] = x2 - x1;
		veku1[1] = y2 - y1;
		veku2[0] = x4 - x3;
		veku2[1] = y4 - y3;
		if (fabs(veku1[0]*veku2[1]-veku1[1]*veku2[0]) <= 0.0000001) {
			veku1[0] = x3 - x1;
			veku1[1] = y3 - y1;
			veku2[0] = x4 - x1;
			veku2[1] = y4 - y1;
			if (fabs(veku1[0]*veku2[1]-veku1[1]*veku2[0]) <= 0.0000001) {
				cout << "NO" << endl;
			} else {
				cout << "YES" << endl;
			}
		} else {
			cout << "NO" << endl;
		}
	}
	return 0;
}

C++: #include <iostream>

using namespace std;
 
int main(){
  double a,b,c,d,e,f,g,h;
  int t;
  
  cin >> t;
  while(t--){
    cin >> a >> b >> c >> d >> e >> f >> g >> h;
    cout << ((d-b)/(c-a) == (h-f)/(g-e) ? "YES" : "NO") << endl;
  }
 
  return 0;
}

C++: #include <iostream>
#include <cmath>
using namespace std;
// const double eps = 1e-9;
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;
        x1 -= x2;
        y1 -= y2;
        x3 -= x4;
        y3 -= y4;
        cout << (x1 * y3 - y1 * x3 == 0 ? "YES" : "NO") << endl;
    }
    return 0;
}

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

int main()
{
    int n;
    cin>>n;
    while(n--){
        pair<double,double>a[4];
        for(int i=0;i<4;i++){
            cin>>a[i].first>>a[i].second;
        }
        if((a[1].first-a[0].first)==0&&(a[3].first-a[2].first)==0)
            cout<<"NO"<<endl;
        else if((a[1].second-a[0].second)/(a[1].first-a[0].first)!=(a[3].second-a[2].second)/(a[3].first-a[2].first))
            cout<<"NO"<<endl;
        else
            cout<<"YES"<<endl;
    }
    return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<string>
using namespace std;
int main() {
	int n;
	cin >> n;
	for (int z = 0; z < n; z++) {
		long float x1, x2, x3,y1, y2, y3, y4, x4 ;
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		if (y1 > y2) {
			swap(y1, y2);
			swap(x1, x2);
		}
		if (y3 > y4) {
			swap(y3, y4);
			swap(x3, x4);
		}
		if ((x1 > x2&&x3 > x4 && ((y2 - y1) / (x1 - x2) == (y4 - y3) / (x3 - x4))) || (x2 > x1&&x4 > x3 && ((y1 - y2) / (x2 - x1) == (y3 - y4) / (x4 - x3)))) {
			cout << "YES" << endl;
		}
		else {
			cout << "NO" << endl;
		}
	}
}

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

class vec2d {
public:
  double x,y;
  void set(double x=0,double y=0) {
    this->x = x;
    this->y = y;
  }
};
double cross(vec2d A,vec2d B) {
  return (A.x*B.y - B.x*A.y);
}
bool is_paralles(vec2d A,vec2d B) {
  if(cross(A,B) < 1e-9) return true;
  return false;
}

int main() {
  int n;
  cin >> n;
  while(n--) {
    double x1,y1,x2,y2;
    vec2d p[2];
    for(int i=0;i<2;i++) {
      cin >> x1 >> y1 >> x2 >> y2;
      p[i].set(x2 - x1,y2 - y1);
    }
    if(is_paralles(p[0],p[1])) {
      cout << "YES" << endl;
    }
    else {
      cout << "NO" << endl;
    }
  }
}

C++: #include <iostream>
using namespace std;
void judge(double,double,double,double,double,double,double,double);

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;
		judge(x1, y1, x2, y2, x3, y3, x4, y4);
	}
	
	return 0;
}

void judge(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4) {
	double abx = x2 - x1;
	double aby = y2 - y1;
	double cdx = x4 - x3;
	double cdy = y4 - y3;
	if (aby / abx == cdy / cdx) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}

	return;

}

C++: 
#include <iostream>
#include <complex>
#include <cmath>

using namespace std;

typedef complex<double> Point;

int main() {
    int N;
    cin >> N;
    while(N--) {
        Point ps[4];
        for(int i = 0; i < 4; ++i) cin >> ps[i].real() >> ps[i].imag();
        Point v1 = ps[1]-ps[0], v2 = ps[3]-ps[2];

        double dot = v1.real()*v2.real() + v1.imag()*v2.imag();
        double n = norm(v1) * norm(v2);
        if(abs(dot*dot - n) < 1e-9) cout << "YES" << endl;
        else cout << "NO" << endl;
    }
    return 0;
}

C++: #include<string>
#include<cstdio>
#include<iostream>
 
using namespace std;
  
int main(){
    int n;
    double x[6],y[6];
 
    cin >>n;
    while(n--){
        cin >>x[0]>>y[0]>>x[1]>>y[1]>>x[2]>>y[2]>>x[3]>>y[3];
         
        x[4]=x[0]-x[1];
        y[4]=y[0]-y[1];
        x[5]=x[2]-x[3];
        y[5]=y[2]-y[3];
 
        if(x[4]*y[5]-x[5]*y[4]) cout<< "NO" << endl;
        else cout<<"YES" << endl;
    }
  
    return 0;
}

C++: #include<stdio.h>

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