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")
			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 <complex>
#include <iostream>
#include <cmath>
using namespace std;

typedef complex<double> xy_t;
double cross_product(xy_t a, xy_t b) { return (conj(a)*b).imag(); }
const double eps = 1e-11;
double x[4],y[4];
int N;
int main() {
	cin >> N;
	for (int i=0; i<N; ++i) {
		for (int i=0; i<4; ++i) {
			cin >> x[i] >> y[i];
		}
		xy_t a[2] = {
					xy_t(x[0],y[0]) - xy_t(x[1],y[1]),
					xy_t(x[2],y[2]) - xy_t(x[3],y[3])
				};
		bool p = abs(cross_product(a[0],a[1]))/2 < 0;
		cout << ( p ? "YES" : "NO") << endl;
	}
}

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

using namespace std;

void swap(double &x, double &y, double &xx, double &yy) 
{
  double tmp_x = x;
  double tmp_y = y;
  x = xx;
  y = yy;
  xx = tmp_x;
  yy = tmp_y;
}

bool isZero(double x) 
{
  return x < 0.00001;
}

void compute(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4) 
{
  if (x1 > x2)
    swap(x1, y1, x2, y2);
  else if (x1 == x2 && y1 > y2)
    swap(x1, y1, x2, y2);
  if (x3 > x4)
    swap(x3, y3, x4, y4);
  else if (x3 == x4 && y3 > y4)
    swap(x3, y3, x4, y4);

  double diff_x12 = x2 - x1;
  double diff_y12 = y2 - y1;
  double diff_x34 = x4 - x3;
  double diff_y34 = y4 - y3;

  // if (isZero(diff_x12) && isZero(diff_y12))
  //   cout << "NO" << endl;
  // else if (isZero(diff_x34) && isZero(diff_y34))
  //   cout << "NO" << endl;  
 if (!isZero(diff_x12) && !isZero(diff_x34)) {
    double ab = diff_y12 / diff_x12;
    double cd = diff_y34 / diff_x34;
    if (isZero(abs(ab - cd)))
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }
  else if (isZero(diff_x12) && isZero(diff_x34)) 
    cout << "YES" << endl;  
  else
    cout << "NO" << endl;  
}

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;

    //cout << x1 << " " << y1 << " " << x2 << " " << y2 << " " << x3 << " " << y3 << " " << x4 << " " << y4;
    

    compute(x1, y1, x2, y2, x3, y3, x4, y4);
  }
  
  return 0;
}

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

int main() {
    int n; cin >> n;
    while (n--) {
        vector<pair<double, double>> p(4);
        for (int i = 0; i < 4; i++) {
            double x, y; cin >> x >> y;
            p[i] = {x, y};
        }

        double l1_r = p[1].first - p[0].first;
        double l1_i = p[1].second - p[0].second;
        double l2_r = p[3].first - p[2].first;
        double l2_i = p[3].second - p[2].second;

        if (abs(l1_r * l2_i - l1_i * l2_r) < 1e-10)
            cout << "YES" << endl;
        else
            cout << "NO" << endl;
    }
}

C++: #include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <climits>
using namespace std;

int main(){
    double EPS = 1e-12;
    double x[4];
    double y[4];
    double s;
    double t;
    double u;
    double v;
    int n;
    cin >> n;

    cout << "NO" << endl;
}

C++: #include <cmath>
#include <iostream>
#include <string>
#include <cstdlib>
#include <cstdio>
#include <algorithm>
#include <sstream>

using namespace std;

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

int main(){
    int n;
    vec p[4];
    cin >> n;
    while(n--){
        for(int i=0;i<4;i++)
            cin >> p[i].x >> p[i].y;
        p[0].x-=p[1].x;
        p[0].y-=p[1].y;
        p[2].x-=p[3].x;
        p[2].y-=p[3].y;
        if((int)(p[0].x*p[2].y-p[0].y*p[2].x)==0) cout << "YES" << endl;
        else cout << "NO" << endl;
    }
    return 0;
}

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

int main(){
	int n;cin >> n;
	double a[8];
	while(n--){
		for(int i = 0;i < 8;i++)cin >> a[i];
		if((a[3]-a[1])/(a[2]-a[0]) == (a[7]-a[5])/(a[6]-a[4]))cout << "YES" << endl;
		else cout << "NO" << endl;
	}
	return 0; 
}

C++: #include <functional>
#include <algorithm>
#include <iostream>
#include <numeric>
#include <iomanip>
#include <utility>
#include <cstdlib>
#include <sstream>
#include <bitset>
#include <vector>
#include <cstdio>
#include <ctime>
#include <queue>
#include <deque>
#include <cmath>
#include <stack>
#include <list>
#include <map>
#include <set>

using namespace std;


#define rep(i,n) for(int i=0;i<(n);i++)

const double EPS = 1e-10;
const double INF = 100000000;

bool solve(double x1,double y1,double x2,double y2,double x3,double y3,double x4,double y4){
    double ax,ay,bx,by;
    ax=x2-x1;ay=y2-y1;
    bx=x4-x3;by=y4-y3;
    
    if(ay/ax - by/bx < EPS)return true;
    else return false;
    
}



int main(){
    int n;
    cin>>n;
    rep(i,n){
        double x1, y1, x2, y2, x3, y3, x4, y4;
        cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
        cout<<(solve(x1, y1, x2, y2, x3, y3, x4, y4)? "YES":"NO")<<endl;
        
    }

    return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
int main(){
  double n,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(abs(y1-y2)/abs(x1-x2)==abs(x3-x4)/abs(y3-y4)){
      cout << "YES" << endl;
    }else{
      cout << "NO" << endl;
    }
  }
  return 0;
}

C++: #include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <string>
#include <map>
#include <functional>
#include <cmath>
#include <cstdio>
using namespace std;

int main(){
  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;
    }
  }
}

C++: #include <stdio.h>
int main(void){
    int b[100],n;
    double a[100],c[100];
        scanf("%d",&n);
        for(b[2]=1;b[2]<=n;b[2]++){
            for(b[3]=1;b[3]<=8;b[3]++){
                scanf("%lf",&a[b[3]+10*n]);
            }
        }


for(b[2]=1;b[2]<=n;b[2]++){


        if(a[6+10*n]/a[7+10*n]==a[2+10*n]/a[3+10*n]){
            printf("YES\n");
        }
        else printf("NO\n");
            }




    return 0;
}

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

int main()
{
	int n,i ;
	cin >> n ;

	double ax,ay,bx,by,cx,cy,dx,dy,a,b ;

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

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

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

C++: #include <stdio.h>

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

	scanf("%d",&num) ;
	for( int i = 0 ; i < num ; i ++ )
	{
		scanf("%lf %lf %lf %lf %lf %lf %lf %lf", &ax , &ay , &bx , &by , &cx , &cy , &dx , &dy ) ;

		if( ((by-ay)/(bx-ax)) == ((dy-cy)/(dx-cx)) ) printf("YES\n") ;
		else printf("NO\n") ;
	}
	return 0;
}