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;
    double x1,y1,x2,y2,x3,y3,x4,y4;
    cin >> N;
    for (int n = 0; n != N; ++n) {
        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++: #include<cmath>
#include<iostream>

#define	EPS		1e-9

using namespace std;

class Point{
public:
	double x,y;
	Point(){}
	Point(double xx,double yy) : x(xx),y(yy){}
};

Point &operator -=(Point &a,const Point &b)
{
	a.x-=b.x;
	a.y-=b.y;
	return a;
}

double cross(const Point &a,const Point &b)
{
	return a.x*b.y-a.y*b.x;
}

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

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

int main() {

  int n;
  cin >> n;

  for ( int i = 0; i < n; i++ ) {

    double x[4],y[4];
    cin >> x[0] >> y[0] >> x[1] >> y[1] >> x[2] >> y[2] >> x[3] >> y[3];

    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;
      }

    }else {

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

    }

  }

  return 0;

}

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

struct Pos {
	double x, y;
}a, b, c, d;

int main() {
	int n;
	cin >> n;
	for(int i = 0; i < n; i++ ) {
		cin >> a.x >> a.y >> b.x >> b.y >> c.x >> c.y >> d.x >> d.y;
		Pos e;
		e.x = b.x - a.x;
		e.y = b.y - a.y;
		Pos f;
		f.x = d.x - c.x;
		f.y = d.y - c.y;
		
		double men = e.x * f.y - e.y * f.x;
		double eps = 1e-10;
		if(-eps <= men && men <= eps)
			cout << "YES" << endl;
		else
			cout << "NO" << endl;
	}
	return 0;
}

C++: #include<vector>
#include<iostream>
#include<cstdio>
using namespace std;
int n;
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);
      if((y1-y2)*(x4-x3)-(y4-y3)*(x1-x3)==0) printf("YES\n");
      else printf("NO\n");
    }
}

C++: #include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define LOOP(i,x,n) for(int i=x;i<n;i++)
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define MP make_pair
#define FR first
#define SC second
#define int long long
const double eps=1e-9;
using namespace std;
const int MOD=1000000007;
const int INF=9000000009;

signed 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;
    cout<<(abs((y2-y1)*(x4-x3)-(y4-y3)*(x2-x1))<eps?"YES":"NO")<<endl;
  }
  return 0;
}

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

double EPS = 1e-10;
// 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 = x2 - x1, t = y2 - y1, u = x4 - x3, v = y4 - y3;
	 	if (s * v - t * u < EPS) {
		 	printf("YES\n");
	 	} else {
		 	printf("NO\n");
	 }
	}

	return 0;
}

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

C++: #include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <functional>
#include <string>
#include <algorithm>
#include <climits>
#include <utility>

#define PRINT(STR) cout << STR << endl;
#define REP(i, n) for (int (i) = 0; (i) < (int)(n); (i)++)
#define REG(i, a, b) for (int (i) = ((int)(a)); (i) < ((int)(b)); i++)
#define ALL(V) (V).begin(), (V).end()

typedef long long ll;

using namespace std;

int nextInt() { int n = -1; cin >> n; return n; }
double nextDouble() { double d = -1; cin >> d; return d; }
ll nextll() { ll n = -1; cin >> n; return n; }
string nextString() { string str; cin >> str; return str; }

int INF = 9999999;

// BEGIN //////////////////////////////////////////////////////////////


int main() {
	int N = nextInt();
	REP(i, N) {
		double x1 = nextDouble();
		double y1 = nextDouble();
		double x2 = nextDouble();
		double y2 = nextDouble();
		double x3 = nextDouble();
		double y3 = nextDouble();
		double x4 = nextDouble();
		double y4 = nextDouble();

		if (x2 - x1 == 0 || x4 - x3 == 0) {
			if (y2 - y1 == 0 && y4 - y3 == 0) {
				PRINT("YES");
			} else {
				PRINT("NO");
			}
		} else {
			if ((y2 - y1) / (x2 - x1) - (y4 - y3) / (x4 - x3) < 1e-8) {
				PRINT("YES");
			} else {
				PRINT("NO");
			}
		}
	}

	return 0;
}

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

C++: #include<iostream>
 
int main()
{
    int n;
 
    std::cin >> n;
 
    double x1,y1,x2,y2,x3,y3,x4,y4;
 
    for(int i=0;i<n;++i)
    {
        std::cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
 
        double m1 = (y1-y2)/(x1-x2);
 
        double m2 = (y3-y4)/(x3-x4);
 
        std::cout <<  (m1==m2 ? "YES":"NO") << '\n';
    }
}

C++: //
//
//
//
//
//
//

#include <iostream>
#include <complex>

using namespace std;
typedef complex<double> xy_t;

double cross_product(complex<double> a, complex<double> b)
{
  return (conj(a) * b).imag();
}

int main()
{
  int n; //??????????????°
  cin >> n;
  while (n > 0) {
    complex<double> a, b, c, d, e, f;
    double real[4], imag[4];
    for (int i = 0; i < 4; i++)
      cin >> real[i] >> imag[i];
    
    a = xy_t(real[0], imag[0]);
    b = xy_t(real[1], imag[1]);
    c = xy_t(real[2], imag[2]);
    d = xy_t(real[3], imag[3]);
    
    e = a - b;
    f = c - d;
    double judge = cross_product(e, f);
    if (abs(judge) < 1e-11)
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
    n--;
  }
}

/*
complex?????????????§????????????§???????????????????????????????????§?????????????????°??¢????????¨???????????????
double????????£??????????????¨????????£???????????????????????¨????°???\?????????????????¶??????????????????????????????
????????????????????¬????¬????????????????????????????
????????\????????????????????????????????????????????¨???????????????
*/

C++: #include<iostream>
using namespace std;
int main(){
    int n;
    double 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;

        double line1,line2;
        line1=(y2-y1)/(x2-x1);
        line2=(y4-y3)/(x4-x3);
        (line1==line2)? cout<<"YES"<<endl:cout<<"NO"<<endl;
    }
}