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 <string>
#include<stdio.h>

using namespace std;

int main(int argc, char* argv[])
{
	double x1, y1, x2, y2, x3, y3, x4, y4;
	int tendAB, tendCD;
	int num;

	cin >> num;
	while (num--) {
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		tendAB = (y1 == y2) ? 0 : (x2 - x1) / (y2 - y1) * 100000;
		tendCD = (y3 == y4) ? 0 : (x4 - x3) / (y4 - y3) * 100000;;
		if (tendAB == tendCD) cout << "YES" << endl; else cout << "NO" << endl;
	}

	return 0;
}

C++: #include <iostream>
#include <complex>
#include <cmath>
#include <algorithm>
#include <string>
#include <utility>
#include <vector>

#define EPS (1e-5)
#define EQ(a,b) (abs((a)-(b)) < EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )

using namespace std;
typedef complex<double> P;

int main(){
  double x1,y1,x2,y2,x3,y3,x4,y4;
  int n;
  P a,b;
  cin>>n;
  for(;n>0;n--){
    cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
    a = P(x2-x1,y2-y1);
    b = P(x4-x3,y4-y3);
    if (EQV(a/abs(a),b/abs(b)))
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }
  return 0;
}

C++: #include <bits/stdc++.h>
#define REP(i,n) for(int i=0; i<(int)(n); ++i)

using namespace std;

typedef complex<double> Point;

const double EPS = 1e-10;

int sign(double x){
    if(x > EPS) return 1;
    if(x < -EPS) return -1;
    return 0;
}
struct Line : public vector<Point> {
    Line(const Point& a, const Point& b) {
        push_back(a); push_back(b);
    }
    Point vector() const {
        return back() - front();
    }
};

double cross(Point a, Point b){
    return imag(conj(a) * b);
}

bool paralell(Line l, Line m){
    return sign(cross(l.vector(), m.vector())) == 0;
}

int main(){
    int N;
    cin >> N;
    while(N--){
        Point p[4];
        REP(i, 4){
            double x, y;
            cin >> x >> y;
            p[i] = Point(x, y);
        }
        Line l1(p[0], p[1]);
        Line l2(p[2], p[3]);
        if(paralell(l1, l2)){
            cout << "YES" << endl;
        }else{
            cout << "NO" << endl;
        }
    }
    return 0;
}

C++: #include<iostream>
#include<cmath>
using namespace std;
int main(){
	double x1, y1, x2, y2, x3, y3, x4, y4, p1, p2;
	int n;
	cin >> n;
	while(n--){
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		p1 = (y2 - y1) / (x2 - x1);
		p2 = (y4 - y3) / (x4 - x3);
		if(abs(p1 - p2) < 1e-9)
			cout << "YES" << endl;
		else
			cout << "NO" << endl;	
	}
}

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

using namespace std;

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)

typedef complex<double> P;
typedef vector<P> VP;
const double EPF = 1e-10;

#define X real()
#define Y imag()
#define EQ(x,y) (abs(x-y) < EPF)

double dot(P a, P b) {
  return (conj(a)*b).X;
}
double cross(P a, P b) {
  return (conj(a)*b).Y;
}
double distPP(P a, P b) {
  return sqrt(dot(a-b,a-b));
}
P crosspoint(P a, P b, P c, P d) {//ac , bd
  double d1 = cross(d-b,b-a);
  double d2 = cross(d-b,c-a);
  if(EQ(d1,0) & EQ(d2,0)) return a;
  if(EQ(d2,0)) return a;
  return a + (c-a)*d1/d2;
}
P normal_vector(P a) {
  P b(-a.Y, a.X);
  return b;
}
P polar(double r, double theta) {
  P a(r*cos(theta),r*sin(theta));
  return a;
}

int main() {
  int n;
  scanf("%d",&n);
  REP(i,n) {
    double x,y;
    P a,b,c,d;
    scanf("%lf %lf", &x, &y);
    a = P(x,y);
    scanf("%lf %lf", &x, &y);
    b = P(x,y);
    scanf("%lf %lf", &x, &y);
    c = P(x,y);
    scanf("%lf %lf", &x, &y);
    d = P(x,y);
    
    if(EQ(cross(a-b, c-d),0))printf("YES\n");
    else printf("NO\n");
  }
  return 0;
}

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

double EPS = 1e-8;

//??\????????°???????????°?????????????????????
//????¬?????????????????????????
//??¢??°vAdd, vSet????????????????????????????????¢?????????????????¶public:
//???????????????????????°??????????????§????????¨?????¶
//??\???????????§??????????????????????????????????????????????????????
class C3DVec{
    private:    //private: ????????¨???????????¢??????????????§?????????
    
    public:     //public: ????????¨???????????¢???????????????
    double x, y;
    
    //??°????????????????????????+????????????????????????
    C3DVec operator+(C3DVec v2){
        C3DVec vRet;
        
        //???????????????v?????¨??????
        vRet.x = x + v2.x;
        vRet.y = y + v2.y;
    
        return vRet;
    }
    
    //????§???????????????????????????????
    C3DVec operator-(C3DVec v2){
        C3DVec vRet;
        
        //???????????????v1??¨??????
        vRet.x = x - v2.x;
        vRet.y = y - v2.y;
        
        return vRet;
    }
    
    //????§?????????????????????¨??????????????????????????????
    C3DVec operator*(float sc){
        C3DVec vRet;
        
        vRet.x = x * sc;
        vRet.y = y * sc;
        
        return vRet;
    }
    
    
    
    //()????????????????????????????????°????????????????????±??????
     void operator() (double ix, double iy){
        C3DVec vRet;
    
        x = ix;
        y = iy;
    }
};

//???????????¨?????\??????????????????????????????????????????????????????????????¢??°
C3DVec operator*(float sc, C3DVec vi){
    C3DVec vRet;
    
    //?????????????????????????????????????????°????????????????????§???
    //??¢??°??????????????????????????????????????????
    vRet.x = vi.x * sc;
    vRet.y = vi.y * sc;
    
    return vRet;
}

//????????????????????????????????????
    double dot(C3DVec v1, C3DVec v2){
        return (v1.x * v2.x) + (v1.y * v2.y);
    }


int main(void){
    C3DVec va, vb, vc, vd;
    double x1, x2, x3, x4, y1, y2, y3, y4;
    int n;
    
    cin >> n;
    for(int i = 0; i < n; i++){
        //??????????????????
        cin >> x1 >> y1 >> x2 >> y2;
        cin >> x3 >> y3 >> x4 >> y4;
        
        //?????????????????????
        va(x1, y1);
        vb(x2, y2);
        vc(x3, y3);
        vd(x4, y4);
        
        //????????????????????????
        C3DVec vAB = vb - va;
        C3DVec vCD = vd - vc;
         
        //???????????¶????????????????????????
        if(dot(vAB, vCD) > EPS) cout << "YES" << endl;
        else            cout << "NO"  << endl;; 
    }
    
    return 0;
}

C++: #include<stdio.h>
 
int main(void){
    double x[4],y[4];
    int n,i;
     
    scanf("%d",&n);
     
    for(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(((y[1]-y[0])/(x[1]-x[0])) == ((y[3]-y[2])/(x[3]-x[2])))printf("YES\n");
        else printf("NO\n");
    }
     
    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)/(x2-x1) == (y4-y3)/(y2-y1))
      cout << "YES";
    else
      cout << "NO";
    cout << endl;
  }

  return 0;
}