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<iostream>

using namespace std;

bool get_line( double x1 , double x2 , double y1 , double y2 , double& a , double& b );

int main(void)
{
	double x1, x2, x3, x4;
	double y1, y2, y3, y4;

	double a1, a2;
	double b1, b2;

	bool result1 , result2;

	int num;

	cin >> num;

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

		result1 = get_line( x1 , x2 , y1 , y2 , a1 , b1 );
		result2 = get_line( x3 , x4 , y3 , y4 , a2 , b2 );

		if( result1 == false && result2 == false ) cout << "YES" << endl;

		else
		{
			if( a1 != a2 ) cout << "NO" << endl;
			else cout << "YES" << endl;
		}
	}

	return 0;
}

bool get_line( double x1 , double x2 , double y1 , double y2 , double& a , double& b )
{
	if( x1 - x2 >= -0.0001 && x1 - x2 <= 0.0001 ) return false;

	a = ( y1 - y2 ) / ( x1 - x2 );
	b = y1 - a * x1;

	return true;
}

C++: #include <stdio.h>

int
main(void)
{
	int n;

	scanf("%d", &n);

	double x1, y1, x2, y2, x3, y3, x4, y4;
	
	while (n--) {
		scanf("%lf %lf %lf %lf %lf %lf %lf %lf",
				   &x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4);

		printf("%s\n", (((y2 - y1)/(x2 - x1) ==(y4 - y3)/(x4 - x3)) ? "YES" : "NO"));
	}

	return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <deque>
#include <list>
#include <string>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>

using namespace std;

int n;
double x1,x2,x3,x4,ya1,y2,y3,y4;

int main() {
	cin >> n;

	for (int i = 0; i < n; i++) {
		cin >> x1 >> ya1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		
		if (x1 > x2) {
			double tmp = x1;
			x1 = x2;
			x2 = tmp;
			tmp = ya1;
			ya1 = y2;
			y2 = tmp;
		}
		if (x3 > x4) {
			double tmp = x3;
			x3 = x4;
			x4 = tmp;
			tmp = y3;
			y3 = y4;
			y4 = tmp;
		}
		

		if (x1 == x2) {
			if (x3 == x4) cout << "YES" << endl;
			else cout << "NO" << endl;
		} else {
			if (x3 == x4) cout << "NO" << endl;
			else {
				if (abs((y2 - ya1) / (x2 - x1) - (y4 - y3) / (x4 - x3)) <= 0.00000000001)
					cout << "YES" << endl;
				else cout << "NO" << endl;
			}
		}
	}

	return 0;
}

/*@@@@@@@@@@@@@@@@@@@@@@@@@*/
/*@                       @*/
/*@ debug output erased ? @*/
/*@                       @*/
/*@@@@@@@@@@@@@@@@@@@@@@@@@*/

C++: #include<bits/stdc++.h>
using namespace std;
main(void){
	int T;cin>>T;
	double x1,x2,x3,x4,y1,y2,y3,y4;
	for(int t=1;t<=T;t++){
		cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
		if(abs((x1-x2)*(y3-y4)-(y1-y2)*(x3-x4))<0.0000001)
			cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
	}
}

C++: #include <cstdio>

using namespace std;

double x1,y1,x2,y2,x3,y3,x4,y4;
    

int main()
{
    int n; scanf( "%d\n", &n );
    while( n > 0 ){
        loop:
        scanf("%lf %lf %lf %lf %lf %lf %lf %lf %lf\n", &x1, &y1, &y2, &y2, &y3, &y3, &y4, &y4 );
        double num1 = x2 - x1, num2 = x4 - x3, num3 = y2 - y1, num4 = y4 - y3;
        if( (num1 == 0 && num3 == 0) || (num2 == 0 && num4 == 0 ) )
        {
            printf( "YES\n" );
            n--;
            goto loop;
        }
        else
        {
            num2 /= num1;
            num4 /= num3;
            if( num3 == num4 || num3 == -num4 )
            {
                printf( "YES\n" );
                n--;
                goto loop;
            }
        }
        printf( "NO\n" );
        n--;
    }
}

C++: #include <iostream>

using namespace std;

typedef struct myvector{
  double x;
  double y;
}Vector;

Vector sub_vector(Vector& a, Vector& b)
{
  Vector ret;
  ret.x = b.x - a.x;
  ret.y = b.y - a.y;
  return ret;
}

double cross_product(Vector& a, Vector& b)
{
  return a.x * b.y - b.x * a.y;
}

int main()
{
  int n;
  cin >> n;
  for(int i = 0; i < n; i++){
    Vector A, B, C, D;
    cin >> A.x >> A.y >> B.x >> B.y >> C.x >> C.y >> D.x >> D.y;
    Vector AB = sub_vector(A, B);
    Vector CD = sub_vector(C, D);
    if(AB.x * CD.y == AB.y * CD.x)
      cout << "YES" << endl;
    else 
      cout << "NO" << endl;
  }
}

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 <utility>
#include <complex>
#include <vector>

using namespace std;

typedef complex<double> point;

const double EPS = 1e-7;
// double cross(point a,point b){
//     return imag(conj(a)*b);
// }
double cross(point a, point b) {
      return (a.real() * b.imag() - a.imag() * b.real());
}

bool is_parallel(point a1,point a2,point b1,point b2){
    return abs(cross(a2-a1,b2-b1)) < EPS;
}

int main(){
    int N;
    cin >> N;
    for(int i=0;i<N;i++){
        vector<point> ps(4);
        for(int j=0;j<4;j++){
            cin >> ps[j].real() >> ps[j].imag();
        }
        if(is_parallel(ps[0],ps[1],ps[2],ps[3])){
            cout << "YES" << endl;
        }else{
            cout << "NO" << endl;
        }
    }
    return 0;
}

C++: #include <cstdio>

int main(){
    
  int n;
  scanf("%d",&n);
  for( int i = 0 ; i < n ; i++ ){
    double x1,x2,x3,x4;
    double y1,y2,y3,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) ){
      printf("YES\n");
    }
    else printf("NO\n");
  }
}

C++: #include <iostream>
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;
}