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>
#include <string>
#include <cmath>


class Point
{
public:
	double m_X;
	double m_Y;
	Point(double x, double y)
		: m_X( x )
		, m_Y( y )
	{}
};

class LineSegment
{
private:
	Point m_Start;
	Point m_End;
public:
	LineSegment(Point start, Point end)
		: m_Start( start )
		, m_End( end )
	{}
	double CalcSlope()
	{
		if ( m_End.m_Y == m_Start.m_Y)
		{
			return 0.0;
		}

		if (m_End.m_X == m_Start.m_X)
		{
			return 9999999999.0;
		}
	
		return((m_End.m_Y - m_Start.m_Y) / (m_End.m_X - m_Start.m_X));
	}
};

const double EPS = 1e-10;


int main()
{
	int n = 0;
	double x1 = 0;
	double y1 = 0;
	double x2 = 0;
	double y2 = 0;
	double x3 = 0;
	double y3 = 0;
	double x4 = 0;
	double y4 = 0;

	std::cin >> n;

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

		Point start1{ x1, y1 };
		Point end1{ x2, y2 };
		Point start2{ x3, y3 };
		Point end2{ x4, y4 };

		LineSegment line1{ start1, end1 };
		double line1_slope = line1.CalcSlope();

		LineSegment line2{ start2, end2 };
		double line2_slope = line2.CalcSlope();

		if ( std::fabs(line1_slope - line2_slope) < EPS )
		{
			std::cout << "YES" << std::endl;
		}
		else
		{
			std::cout << "NO" << std::endl;
		}
	}

	return 0;
}

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

struct Point
{
  double x;
  double y;
};

//              --class Line
class Line
{
  public:
    Line(Point p1, Point p2);

  public:
    bool parallel(Line other); // 平行か

  private:
    Point m_p1;
    Point m_p2;
    double m_slope;     //  傾き
};

Line::Line(Point p1, Point p2)
{
  m_p1 = p1;
  m_p2 = p2;
  m_slope = ( p2.y - p1.y ) / ( p2.x - p1.x );
}

bool Line::parallel(Line other)
{
  return abs(m_slope - other.m_slope) < 0.00001;
}

int main(void)
{
  int n;
  cin >> n;
  for (int i = 0; i < n; ++i)
  {
    Point p1, p2, p3, p4;
    cin >> p1.x >> p1.y >> p2.x >> p2.y >> p3.x >> p3.y >> p4.x >> p4.y;
    Line line1(p1, p2);
    Line line2(p3, p4);
    cout << (line1.parallel(line2) ? "YES" : "NO") << endl;
  }
  return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;

#define times(n, i) uptil(0, n, i)
#define upto(f, t, i) for(auto _##i = (t), i = decltype(_##i)(f) poi  i <= _##i poi  i++)
#define uptil(f, t, i) for(auto _##i = (t), i = decltype(_##i)(f) poi  i < _##i poi  i++)
#define downto(f, t, i) for(auto i = (f), _##i = decltype(i)(t) poi  i >= _##i poi  i--)
#define downtil(f, t, i) for(auto i = (f), _##i = decltype(i)(t) poi  i > _##i poi  i--)

#define unless(c) if(!(c))
#define until(c) while(!(c))
#define loop while(true)

#define poi ;
#define poipoi << "\n"

/*#define do {*/
/*#define end }*/

#define val const auto
#define var auto

#define zenbu(c) c.begin(), c.end()

#define fuwafuwa(n, c) dokidoki((n) + (c) - 1, c)
#define dokidoki(n, c) ((n) / (c) * (c))

template<class T> bool read(T& t){
    return cin >> t poi
}
template<class T, class...U> bool read(T& t, U&... u){
    unless(cin >> t) return false poi
    return read(u...) poi
}

template<class T> bool equal(T a, T b, T eps = 0){
    return abs(a - b) < eps poi
}

int main(){
    int n poi
    cin >> n poi
    times(n, i){
        double x1, y1, x2, y2, x3, y3, x4, y4 poi
        read(x1, y1, x2, y2, x3, y3, x4, y4) poi
        cout << (equal((x1 - x2) * (y3 - y4), (x3 - x4) * (y1 - y2), 1e-10) ? "YES" : "NO") poipoi poi
    }

    return 0 poi
}

C++: #include <iostream>
#include <stdio.h>
using namespace std;
typedef struct vec vec;

struct vec {
	double x, y;
};

static vec P(double x, double y){
	vec P = {x, y};
	return P;
}

static vec sub(vec a, vec b){
	return P(a.x - b.x, a.y - b.y);
}

static double cross(vec a, vec b){
	return (a.x * b.y - a.y * b.x);
}

int main(void){
    
    int n;
    while(cin >> n){
	    double D[8];
	    vec V[4];
	    for(int i = 0; i < n; i++){
	        scanf("%lf %lf %lf %lf %lf %lf %lf %lf", &D[0], &D[1], &D[2], &D[3], &D[4], &D[5], &D[6], &D[7]);
	    	for(int j = 0; j < 4; j++){
	    		V[j] = P(D[2*j], D[2*j+1]);
	    	}
	    	vec a = sub(V[0], V[1]);
	    	vec b = sub(V[2], V[3]);
	    	if (cross(a, b) == 0){
	    		cout << "YES" << endl;
	    	}
	    	else{
	    		cout << "NO" << endl;
	    	}
	    }
	}
    return 0;

}

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

int main()
{
  double x1,x2,x3,x4,y1,y2,y3,y4;
  double dx1,dy1,dx2,dy2;
  int n;
  int i;

  cin>>n;
  for(i=0;i<n;i++){
    cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
    dx1=x2-x1;
    dy1=y2-y1;
    dx2=x4-x3;
    dy2=y4-y3;

    if(dx1==0 && dx2==0)
      cout<<"YES"<<endl;
    else if(dx1==0 || dx2==0)
      cout<<"NO"<<endl;
    else if(dy1*dx2 == dy2*dx1)
      cout<<"YES"<<endl;
    else
      cout<<"NO"<<endl;
  }
}

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

int main()
{
  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 >> 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 <cstdio>
using namespace std;

const double EPS = 1e-5;

signed main() {
  int n;

  cin >> n;
  while (n--) {
    double x[4], y[4];
    for (int i = 0; i < 4; cin >> x[i] >> y[i], i++);
    if ((y[1] - y[0]) / (x[1] - x[0]) - (y[3] - y[2]) / (x[3] - x[2]) < EPS) {
      puts("YES");
    } else {
      puts("NO");
    }
  }

  return 0;
}

C++: #include <iostream>

int main(){
	double x1,y1,x2,y2,x3,y3,x4,y4
	double a,b;
	int n;
	std::cin >> n;
	for(int i=0 ; i<n ; ++i){
		std::cin >>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
		bool parallel=false;
		a=(y2-y1)/(x2-x1);
		b=(y4-y3)/(x4-x3);
		if(x1==x2 && x3==x4) {
			parallel=true;
			goto result;
		}
		else if(x1==x2 || x3==x4) {
			goto result;
		}
		else if (a==b) {
			parallel=true;
		}
		result:
		std::cout << ( parallel ? "YES" : "NO") << std::endl;
	}
	return 0; 
}

C++: #include "bits/stdc++.h"
using namespace std;
using ll = long long;
using vi = vector<int>;
using vii = vector<vector<int>>;
using vl = vector<ll>;
using vll = vector<vector<ll>>;
using pii = pair<int,int>;
#define FOR(i,a,b) for(ll i = (a); i < (b); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(obj) (obj).begin(), (obj).end()
#define pb push_back
const double pi = acos(-1);
const double EPS = 1e-10;

double cross(pair<double,double> c,pair<double,double> d){
  return c.first * d.second - d.first * c.first;
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  vector<pair<double,double>> a(4);
  int n;
  pair<double,double> lineab, linecd;
  cin >> n;
  REP(i,n){
    REP(j,4){
      cin >> a[j].first >> a[j].second;
    }
    lineab.first = a[1].first - a[0].first;
    linecd.first = a[3].first - a[2].first;
    lineab.second = a[1].second - a[0].second;
    linecd.second = a[3].second - a[2].second;
    if (fabs(cross(lineab,linecd)) < EPS) {
      cout << "YES" << endl;
    } else {
      cout << "NO" << endl;
    }
  }
  
  
  return 0;
}