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>

enum {X1,Y1,X2,Y2,X3,Y3,X4,Y4};

void calcDistance(int x1, int y1, int x2, int y2, int* dx, int* dy) {
	if(x1 < x2) {
		*dx = x2 - x1;
		*dy = y2 - y1;
	} else {
		*dx = x1 - x2;
		*dy = y1 - y2;
	}
}

int main() {
	int n; std::cin >> n;
	double dp[8];
	int ip[8],dx1,dy1,dx2,dy2;
	for(int i=0; i<n; i++) {
		for(int j=0; j<8; j++) std::cin >> dp[j];
		for(int j=0; j<8; j++) ip[j] = (int)(dp[j] * 1000000);
		if(ip[X1] == ip[X2] || ip[X3] == ip[X4]) {
			if(ip[X1] == ip[X2] && ip[X3] == ip[X4]) {
				std::cout << "YES" << std::endl;
			} else {
				std::cout << "NO" << std::endl;
			}
		} else {
			calcDistance(ip[X1],ip[Y1],ip[X2],ip[Y2],&dx1,&dy1);
			calcDistance(ip[X3],ip[Y3],ip[X4],ip[Y4],&dx2,&dy2);
			if(((long long)dy1 * dx2) == ((long long)dx1 * dy2)) {
				std::cout << "YES" << std::endl;
			} else {
				std::cout << "NO" << std::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[1] - x[0] ) == ( y[3] - y[2] ) / ( x[3] - x[2] ) ) {
	cout << "YES" << endl;
      }else {
	cout << "NO" << endl;
      }

    }

  }

  return 0;

}

C++: #include <iostream>
using namespace std;
 
int main(){
    int n;
    long double t[100][8];
    long double ab, cd;
    cin >> n;
    for(int i = 0; i < n; i++){
        for(int j = 0; j < 8; j++){
            cin >> t[i][j];
        }
    }
    for(int i = 0; i < n; i++){
        ab = (t[i][1]-t[i][3])*(t[i][4]-t[i][6]);
        cd = (t[i][5]-t[i][7])*(t[i][0]-t[i][2]);
        if(t[i][0] == t[i][2]){
            if(t[i][4] == t[i][6]){
                cout << "YES" << endl;
            }
            else{
                cout << "NO" << endl;
            }
        }
        else if(t[i][1] == t[i][3]){
            if(t[i][5] == t[i][7]){
                cout << "YES" << endl;
            }
            else{
                cout << "NO" << endl;
            }
        }
        else if(ab == cd){
            cout << "YES" << endl;
        }
        else{
            cout << "NO" << endl;
        }
    }
}

C++: #include
 <cstdio>

using
 namespace
 std;

int
 n;
double
 x[4],y[4];

int
 main()
 {
	
scanf("%d"
,&n);
	
for
 (int
 c = 0; c < n; c++)
	
{
		
for
 (int
 i = 0; i < 4; i++)
			
scanf("%lf%lf"
,&x[i],&y[i]);
		
puts((y[1]-y[0])/(x[1]-x[0]) == (y[3]-y[2])/(x[3]-x[2])?"YES"
:"NO"
);
	
}
 }

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

    }
    return 0;
}

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

int main(){
	int n;
	double x[4], y[4];
	scanf("%d", &n);
	for(int i = 0; i < n; i++){
		scanf("%lf %lf %lf %lf %lf %lf %lf %lf", &x[0],&y[0],&x[1],&y[1],&x[2],&y[2],&x[3],&y[3]);
		if(fabs(x[0] - x[1]) < 0.000001){
			if(fabs(x[2] - x[3]) < 0.000001){
				printf("YES\n");
			}else{
				printf("NO\n");
			}
		}else{
			if(fabs((y[1] - y[0])/(x[1] - x[0]) - (y[3] - y[2])/(x[3] - x[2])) < 0.000001){
				printf("YES\n");
			}else{
				printf("NO\n");
			}
		}
	}
	return 0;
}

C++: #include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctype.h>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>

using namespace std;

#define EPS 1e-10
#define equals(a,b) (fabs((a)-(b)) < EPS)
//???
class Point{
	public:	
		double x,y;
		Point(double x = 0,double y = 0):x(x),y(y){}
		//?????????
		Point operator + (Point p) { return Point(x + p.x,y + p.y);}
		Point operator - (Point p) { return Point(x - p.x,y - p.y);}
		Point operator * (double a) { return Point(x*a,y*a);}
		Point operator / (double a) { return Point(x/a,y/a);}
		//???????????¨??§??????
		double abs() {return sqrt(norm());}
		double norm() {return x*x+y*y;}

		bool operator < (const Point &p) const{
			return x != p.x ? x < p.x : y < p.y;
		}
		bool operator == (const Point &p) const{
			return fabs(x - p.x) < EPS && fabs(y - p.y) < EPS;
		}
};
//??????
struct Segment{Point p1,p2;};
//????????????
typedef Point Vector;
//??´???
typedef Segment Line;
//???
class Circle{
	public:
		Point c;
		double r;
		Circle(Point c = Point(),double r = 0.0): c(c),r(r){}
};
//????§???¢
//typedef Vector<Point> Polygon;
//????????¨??????
double dot(Vector a,Vector b){
	return a.x*b.x + a.y*b.y;
}
double cross(Vector a,Vector b){
	return a.x*b.y - a.y*b.x;
}

int main(){
	int n;
	cin >> n;
	double x0,y0,x1,y1,x2,y2,x3,y3,s,t;
	for(int i = 0;i < n;i++){
		cin >> x0 >> y0 >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
		Vector v1(x1-x0,y1-y0);Vector v2(x3-x2,y3-y2);
		if(cross(v1,v2) == 0){
			cout << "YES" << endl;
		}else{
			cout << "NO" << endl;
		}
	}
	return 0;
}