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>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <climits>
using namespace std;

int main(){
    double EPS = 1e-12;
    double x[4], y[4];
    int s,t,u,v;
    int n;
    cin >> n;
    for (int t = 0;t < n;++t) {
        for (int i = 0;i < 4;++i){
            cin >> x[i] >> y[i]; 
        }
    }
    s = x[1] - x[0];
    t = y[1] - y[0];
    u = x[3] - x[2];
    v = y[3] - y[2];
    if(s * v - t * u > 0){
        int m = s * v - t * u;
    }
    else{
        int m = t * u - s * v;
    }
    if( m < EPS){
        cout << "YES" << endl;
    }
    else{
        cout << "NO" << endl;
    }
    return 0;
}

C++: #include<cmath>
#include<iostream>
#include<algorithm>
#include<iomanip>
#include<vector>
#include<string>
#include<queue>
#include<stack>
#include<cstdio>
#include<map>
#define rep(i,n) for(int i=0;i<n;i++)
#define fori(i,k,n) for(int i=k;i<n;i++)
using namespace std;
const int dx[4] = { 0, 1, 0, -1 }, dy[4] = { 1, 0, -1, 0 };
const int dX[8] = { 0, 1, 1, 1, 0, -1, -1, -1 }, dY[8] = { 1, 1, 0, -1, -1, -1, 0, 1 };
/*
(char)'1' - (int)48 = (int)1; 


*/


int main()
{
	int n;
	cin >> n;
	while (n--){
		double x[4], y[4];
		rep(i, 4)cin >> x[i]>>y[i];
		x[1] -= x[0]; x[3] -= x[2];
		y[1] -= y[0]; y[3] -= y[2];
		if (x[1] == 0.0)cout << (x[3] == 0.0 ? "YES" : "NO") << endl;
		else if (x[3] == 0.0)cout << "NO" << endl;
		else if (y[1] / x[1] == y[3] / x[3])cout << "YES" << endl;
		else cout << "NO" << endl;

	}
	return 0;

}

C++: #include<iostream>

using namespace std;

int main(){

	int n; cin >> n;
	double x[4],y[4]; //??\????????§?¨?

	for(int i=0;i<n;i++){
		for(int j=0;j<4;j++){
			cin >> x[j] >> y[j];
		}

		if( (y[1] - y[0]) / (x[1] - x[0]) == (y[3] - y[2])/(x[3] - x[2]) ){
			cout << "YES" << endl;
		}else{
			cout << "NO" << endl;
		}
	}
	return 0;
}

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

#define EPS 1e-5
#define EQ(a, b) (fabs((a)-(b)) < EPS)

int main(void){
  int n;
  double x1, y1, x2, y2, x3, y3, x4, y4;
  cin >> n;
  for(int i = 0; i < n; i++){
    double gradAB, gradCD;
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
    gradAB = (x2 - x1) / (y2 - y1);
    gradCD = (x4 - x3) / (y4 - y3);
    if(EQ(gradAB, gradCD)){
      cout << "YES" << endl;
    }else{
      cout << "NO" << endl;
    }
  }
  return 0;
}

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

C++: #include <bits/stdc++.h>

using namespace std;

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

  double cx[4], cy[4];
  for (int i = 0 ; i < n; ++i) {
    for (int j = 0; j < 4; j++)
      cin >> cx[j] >> cy[j];
    
    if (cx[1] != cx[0] && cx[3] != cx[2]) {
      double kx = (cy[1] - cy[0]) / (cx[1] - cx[0]);
      double ky = (cy[3] - cy[2]) / (cx[3] - cx[2]);
      if (abs(kx - ky) < 0.0001) {
        cout << "YES" << endl;
      } else {
        cout << "NO" << endl;
      }
    } else if (cx[1] == cx[0] && cx[3] == cx[2]) {
      cout << "YES" << endl;
    } else if (cy[1] == cy[0] && cy[3] == cy[2]) {
      cout << "YES" << endl;
    } else {
      cout << "NO" << endl;
    }
  }
}

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

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

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

int main() {
	double x[4], y[4];
	double dx[2], dy[2];
	int n;

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

		if (dx[0] * dy[1] == dx[1] * dy[0]) {
			printf("YES\n");
		}
		else {
			printf("NO\n");
		}
	}

	return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
  int n;
  cin >> n;
  double ax,ay,bx,by,cx,cy,dx,dy,ans1,ans2,x,y;
   for(int i=0;i<n;i++){
     cin >> ax >> ay >> bx >> by >> cx >> cy >> dx >> dy;
     x = ax - bx;
     y = ay - by;
     ans1 = y / x;
     x = cx - dx;
     y = cy - dy;
     ans2 = y / x;
     if(ans1==ans2) cout << "YES" << endl;
     if(ans1!=ans2) cout << "NO" << endl;
   }
   return 0;
}

C++: #include <iostream>

using namespace std;

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

  double x1,y1,x2,y2,x3,y3,x4,y4;
  for (int dataset_i = 0; dataset_i < n; dataset_i++) {
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
    if (x2-x1 == 0 && x4-x3 == 0)
      cout << "YES";
    else if (y2-y1 == 0 && y4-y3 == 0)
      cout << "YES";
    else if ((x4-x3)/(y4-y3) == (y2-y1)/(x2-x1))
      cout << "YES";
    else
      cout << "NO";
    cout << endl;
  }

  return 0;
}

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

int main(){
	int N;
	double x1, y1, x2, y2, x3, y3, x4, y4;
	double dx1, dy1, dx2, dy2;
	
	cin >> N;
	
	for(int i = 0; i < N; i++){
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		dx1 = x2 - x1; dy1 = y2 - y1;
		dx2 = x4 - x3; dy2 = y4 - y3;
		if((double)dy1 / dx1 == (double)dy2 / dx2) cout << "YES" << endl;
		else cout << "NO" << endl;
		
		//cout << dx1 * dy2 << " " << dx2 * dy1 << endl;
	}
	
	return 0;
}

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

double EPS = 1e-1;
// BEGIN //////////////////////////////////////////////////////////////
int main() {
	int N;
	scanf("%d", &N);
	for (int i = 0; i < N; i++) {
		double x1, y1, x2, y2, x3, y3, x4, y4;
 		scanf("%lf%lf%lf%lf%lf%lf%lf%lf",&x1,&y1,&x2,&y2,&x3,&y3,&x4,&y4);
	 	double s = x1 - x2, t = y1 - y2, u = x3 - x4, v = y3 - y4;
	 	if (s * v - t * u < EPS) {
		 	printf("YES\n");
	 	} else {
		 	printf("NO\n");
	 }
	}

	return 0;
}

// END   //////////////////////////////////////////////////////////////

C++: #include <iostream>
#include <stdio.h>
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;
		(y1-y2)*(x3-x4)==(y3-y4)*(x1-x2)?cout<<"YES"<<endl:cout<<"NO"<<endl;
	}
    return 0;
}