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<stdio.h>
 #include<string>
 #include<math.h>
 #include<iomanip>
 #include<algorithm>
 #include<string.h>
 #include<cctype>
 #include<map>
 #include<set>
 #include<vector>
 #include<sstream>
 #include<stack>
 
 using namespace std;
 
 double abs(double x)
 {
   if(x<0) return -x;
   else return x;       
 }
  
 int main()
 {
   double x1,y1,x2,y2,x3,y3,x4,y4;
   int n;
   cin>>n;
   while(n--)
   {
     cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
     if((x2==x1&&y2==y1)||(x4==x3&&y4==y3)) cout<<"NO"<<endl;     
     else if(x2==x1&&x3==x4) cout<<"YES"<<endl;
     else 
     {
       double k1=(y2-y1)/(x2-x1);
       double k2=(y4-y3)/(x4-x3);
       if(abs(k1-k2)<0.01) cout<<"YES"<<endl;
       else cout<<"NO"<<endl;     
     }          
   }
   //while(1);      
   return 0;    
 }

C++: #include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <bitset>
#include <numeric>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <stack>
#include <tuple>

using namespace std;

//#define int long long

#define rep(i,n) for(int i = 0; i<n ; i++)
#define FOR(i,a,n) for(int i=a; i<n; i++)
#define REPSTR(i,s) for(int i=0; (s)[i]; i++)
#define REPITR(i,s) for(auto i=(s).begin(); i!=(s).end();i++)

#define RANGE(a,i,b) ((a)<=(i)&&(i)<=(b))

#define pb push_back
#define mp make_pair

#define ALL(a) begin(a), end(a)

#define EXIST(s,x) ((s).find(x)!=(s).end())

#define SET(a,c) memset(a,c,sizeof(a))
#define CLR(a) memset(a,0,sizeof(a))

#ifdef _DEBUG
#define DEBUG(x) cerr<<#x<<":"<<x<<endl
#else
#define DEBUG(x)
#endif

#define PRINTJOIN(x,n) rep(i,n){if(i)cout<<" ";cout<<x[i];}cout<<endl 
#ifdef int
#define INF 1001001001001001001LL
#else
#define INF 1001001001
#endif

typedef long long ll;
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef stringstream SS;

#define PQ priority_queue

#define FST first
#define SEC second

int dx[4] = { 1,0,-1,0 };
int dy[4] = { 0,1,0,-1 };

template <typename T>
struct Point {
    T x;
    T y;
    Point(){}
    Point(T x, T y): x(x), y(y){}
    T operator ^ (Point const& p) {
        return this->x*p.y-this->y*p.x; 
    }
    Point operator + (Point const& p) {
        return Point(this->x+p.x, this->y+p.y);
    }
    Point operator - (Point const& p) {
        return Point(this->x-p.x, this->y-p.y);
    }
    friend istream & operator >> (istream & stream, Point<T>& p) {
        return stream >> p.x >> p.y;
    }
};



const double eps = 1e-10;
signed main(void) {
	cin.tie(0);
	ios::sync_with_stdio(false);
    int n; cin>>n;
    rep(i,n){
    Point<double> p1, p2, p3, p4;
    cin>>p1>>p2>>p3>>p4;
    cout<<(abs((p2-p1)^(p4-p3))<eps? "YES":"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(max(dy1/dx1-dy2/dx2,dy2/dx2-dy1/dx1) < 0.00001)
      cout<<"YES"<<endl;
    else
      cout<<"NO"<<endl;
  }
}

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

const double EPS = 1e-9;

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>

using namespace std;

bool get_line( double , double , double , double , double& );

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

	double a1, a2;

	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 );
		result2 = get_line( x3 , x4 , y3 , y4 , a2 );

		if( result1 == false && result2 == false )
		{
			cout << "YES" << endl;
		}
		else
		{
			if( a1 - a2 >= -1e-10 && a1 - a2 <= 1e-10 ) cout << "YES" << endl;
			else cout << "NO" << endl;
		}
	}

	return 0;
}

bool get_line( double x1 , double x2 , double y1 , double y2 , double& a )
{
	if( x1 - x2 >= -1e-10 && x1 - x2 <= 1e-10 )
	{
		return false;
	}
	else
	{
		a = ( y1 - y2 ) / ( x1 - x2 );

		return true;
	}
}

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

int main(void){

	double n,x1,x2,x3,x4,y1,y2,y3,y4,x5,x6,y5,y6;

	cin>>n;
	for(int i=0;i<n;i++){
	cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
	x5=x2-x1;x6=x4-x3;
	y5=y2-y1;y6=y4-y3;
	if(x5*y6-x6*y5==0) cout<<"YES"<<endl;
	else cout<<"NO"<<endl;
	
	}
    return 0;
}

C++: #include <iostream>
#include <cmath>
using namespace std;
void judge(double,double,double,double,double,double,double,double);
#define EPS 0.00001

int main() {
	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;
		judge(x1, y1, x2, y2, x3, y3, x4, y4);
	}
	
	return 0;
}

void judge(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4) {
	double abx = x2 - x1;
	double aby = y2 - y1;
	double cdx = x4 - x3;
	double cdy = y4 - y3;
	if (abs(abx * cdy - aby * cdx) <= EPS) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}

	return;

}

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

#define EPS 1e-10
 
struct point{
	double x;
	double y;
};

struct line{
	double a;
	double b;
};

bool get_line( const point& a , const point& b , line *a_b );
istream& operator >> ( istream& s , point& p );
 
int main(void)
{
	point a, b, c, d;
 
    line a_b, c_d;
 
    bool result1 , result2;
 
    int num;
 
    cin >> num;
 
    for( int i = 0 ; i < num ; i++ )
    {
        cin >> a >> b >> c >> d;
 
        result1 = get_line( a , b , &a_b );
        result2 = get_line( c , d , &c_d );
 
        if( result1 == false && result2 == false )
        {
            cout << "YES" << endl;
        }
        else
        {
            if( fabs(a_b.a - c_d.a) < EPS ) cout << "YES" << endl;
            else cout << "NO" << endl;
        }
    }
 
    return 0;
}

istream& operator >> ( istream& s , point& p )
{
	return s >> p.x >> p.y;
}

bool get_line( const point& a , const point& b , line *a_b )
{
	if( fabs(a.x - b.x) < EPS ) return false;
	else{
		a_b->a = (a.y - b.y)/(a.x - b.x);
		a_b->b = a.y - (a.x * a_b->a);
		return true;
	}
}

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

using namespace std;

int main(){
  int n;
  cin >> n;
  for(int i=0;i<n;++i){
    double x1,y1,x2,y2,x3,y3,x4,y4;
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
    double vx = x2-x1 , vy = y2-y1;
    double ux = x4-x3 , uy = y4-y3;
    if(abs(vx*uy-ux*vy)<1.e-8){
      cout << "YES" << endl;
    }else{
      cout << "NO" << endl;
    }
  }
}