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>
#include <vector>
#include <algorithm>
#include <map>
#include <math.h>
#include <complex>
using namespace std;
#define rep(i,n) for (int i=0; i < (n); i++)

typedef double D;      // 座標値の型。doubleかlong doubleを想定
typedef complex<D> P;  // Point
typedef pair<P, P> L;  // Line
typedef vector<P> VP;
const D EPS = 1e-9;    // 許容誤差。問題によって変える
#define X real()
#define Y imag()
#define LE(n,m) ((n) < (m) + EPS)
#define GE(n,m) ((n) + EPS > (m))
#define EQ(n,m) (abs((n)-(m)) < EPS)

// 内積　dot(a,b) = |a||b|cosθ
D dot(P a, P b) {
  return (conj(a)*b).X;
}
// 外積　cross(a,b) = |a||b|sinθ
D cross(P a, P b) {
  // return (conj(a)*b).Y;
  return (a.X*b.Y-a.Y*b.X);
}

bool is_parallel(P a1, P a2, P b1, P b2) {
  return EQ(cross(a1-a2, b1-b2), 0.0);
}

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;
    
    if (is_parallel(P(x1, y1), P(x2, y2), P(x3, y3), P(x4, y4))) {
      std::cout << "YES" << std::endl;
    }else {
      std::cout << "NO" << std::endl;
    }
  }

  
  return 0;
}

C++: #include<iostream>

int main(){
  int n;
  double x1,y1,x2,y2,x3,y3,x4,y4;
  const double e = 1e-13;

  std::cin >> n;

  for(int i=0;i<n;i++){
    std::cin >> x1 >> y1
             >> x2 >> y2
             >> x3 >> y3
             >> x4 >> y4;

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

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

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

int main(void){
    int n = 0;
    cin >> n;
    for(int i = 0; i < n; i++){
        double Point[8];
        for(int j = 0; j < 8; j++){
            Point[j] = 0;
        }
        for(int j = 0; j < 8; j++){
            cin >> Point[j];
        }
        vec_s V0 = {Point[0], Point[1]};
        vec_s V1 = {Point[2], Point[3]};
        vec_s V2 = {Point[4], Point[5]};
        vec_s V3 = {Point[6], Point[7]};
        vec_s a = {(V0.x - V1.x), (V0.y - V1.y)};
	    vec_s b = {(V2.x - V3.x), (V2.y - V3.y)};
	    if ((a.x * b.y - a.y * b.x) == 0){
	    		cout << "YES" << endl;
	    	}
	    	else{
	    		cout << "NO" << endl;
	    	}
    }
}

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

C++: #include <iostream>

#define EPS (1e-10)

using namespace std;

double a[2], b[2], c[2], d[2];

bool isParallel() {
  double ax = b[0] - a[0], ay = b[1] - a[1];
  double bx = d[0] - c[0], by = d[1] - c[1];
  double cross = ax * by - ay * bx;
  if (-EPS < cross && EPS > cross)
    return true;
  else
    return false;
}

int main() {
  int n;
  cin >> n;
  if (n < 1) return -1;
  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 (isParallel()) cout << "YES\n";
    else cout << "NO\n";
  }
  return 0;
}

C++: #include <stdio.h>
#include<cmath>
using namespace std;

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(abs((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(){
  

  int dataSets;
  cin >> dataSets;
  for(int i=0;i<dataSets;i++){
    double x1, y1, x2, y2, x3, y3, x4, y4;
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
    if((y2-y1)*(x4-x3) - (x2-x1)*(y4-y3) < 0.00000001){
      cout << "YES" << endl;
    }else{
      cout << "NO" << endl;
    }
    
  }

  return 0;

}

C++: #include <iostream>
#include <cmath>
using namespace std;
int main(){
    int n;
    cin>>n;
    while(n--){
        float x1, y1, x2, y2, x3, y3, x4, y4;
        cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
        if(((y1-y2)/(x1-x2))==((y3-y4)/(x3-x4)))
            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];
		double y1 = a[3]-a[1];double x1 = a[2]-a[0];
		double y2 = a[7]-a[5];double x2 = a[6]-a[4];
		double ans = y1/x1 - y2/x2;
		if(ans == 0.0)cout << "YES" << endl;
		else cout << "NO" << endl;
	}
	return 0; 
}

C++: #include<bits/stdc++.h>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<algorithm>
using namespace std;

int main(){
    int mod=1000000007;
    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);
        if ((y2-y1)/(x2-x1)-(y4-y3)/(x4-x3)<1e-10) {
            printf("YES\n");
        } else {
            printf("NO\n");
        }
    }
    return 0;
}

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

using namespace std;

#define EPS (1e-9)

double cross_product( double x1, double y1,
					  double x2, double y2 )
{
	return ((x1 * y2) - (x2 * y1));
}

int main( void )
{
	int n;
	while ( 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 (EPS > fabs(cross_product((x2-x1), (y2-y1), (x4-x3), (y4-y3))))
				cout << "YES" << endl;
			else
				cout << "NO" << endl;
		}
	}
	
	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    while(n--)
    {
        float x1,x2,y1,y2,x3,x4,y3,y4;
        cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
        float m1=(y2-y1)/(x2-x1);
        float m2=(y4-y3)/(x4-x3);
        if(m1==m2)
            cout<<"YES"<<endl;
        else
            cout<<"NO"<<endl;
    }



    return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
int main(){
  
  int n;
  double x1,x2,x3,x4,y1,y2,y3,y4,ans1,ans2;
  cin >> n;
  for(int i=0;i<n;i++){
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
    
    if(x1==x2){
      if(x3==x4) cout << "YES" << endl;
      else cout << "NO" << endl;
    }
    else if(x3==x4&&x1!=x2) cout << "NO" << endl;
    else if(y1==y2){
      if(y3==y4) cout << "YES" << endl;
      else cout << "NO" << endl;
    }
    else if(y3==y4&&y1!=y2) cout << "NO" << endl;
    else {
      ans1 = (y1-y2)/(x1-x2);
      ans2 = (y3-y4)/(x3-x4);
      
      if(ans1==ans2) cout << "YES" << endl;
      else cout << "NO" << endl;
    }
  }
  
  return (0);
}