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 <stdio.h>
struct point{
    double x;
    double y;
};
double abs(double a){
if(a>0)return a;
return -a;
}
int main(){
    int n;
    point a[4];
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        for(int j=0;j<4;j++){
            scanf("%lf%lf",&a[j].x,&a[j].y);
        }
        if(a[1].x==a[0].x){
            if(a[3].x==a[2].x)printf("YES\n");
            else printf("NO\n");
        }
        else  if(a[1].y==a[0].y){
            if(a[3].y==a[2].y)printf("YES\n");
            else printf("NO\n");
        }
        else  if(a[3].x==a[2].x){
            printf("NO\n");
        }
        else if(a[3].y==a[2].y){
            printf("NO\n");
        }
        else if(abs(((a[1].x-a[0].x)*(a[3].y-a[2].y))-((a[3].x-a[2].x)*(a[1].y-a[0].y)))<=0.001)printf("YES\n");
        else printf("NO\n");
    }
}

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

int main()
{
    int n;
    cin>>n;
    while(n--){
        pair<double,double>a[4];
        for(int i=0;i<4;i++){
            cin>>a[i].first>>a[i].second;
        }
        if(abs((a[1].first-a[0].first)*(a[3].second-a[2].second)-(a[3].first-a[2].first)*(a[1].second-a[0].second))<1e-10)
            cout<<"YES"<<endl;
        else
            cout<<"NO"<<endl;
    }
    return 0;
}

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

C++: #include <stdio.h>
int main()
{
  int n;
  float x1,y1,x2,y2,x3,y3,x4,y4,k1,k2;
  scanf("%d",&n);
  while(n>0){
    scanf("%f%f%f%f%f%f%f%f",&x1,&y1,&x2,&y2,&x3,&y3,&x4,&y4);
    if(x1==x2 && x3==x4) printf("YES\n");
    else if(x1==x2 || x3==x4) printf("NO\n");
    else {
      k1 = (y2-y1)/(x2-x1);
      k2 = (y4-y3)/(x4-x3);
      k1 = (int)(k1*1000)/1000.0;
      k2 = (int)(k2*1000)/1000.0;
      if(k1==k2) printf("YES\n");
      else printf("NO\n");
    }
    n--;
  }
  return 0;
}

C++: #include <iostream>
using namespace std;
int main(){
  int t;
   float x1,x2,x3,x4,y1,y2,y3,y4;
  cin >> t;
  while(t--){
cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
    if( (y2-y1)/(x2-x1) == (y4-y3)/(x4-x3) ) 
      cout<<"YES\n";
    else
      cout<<"NO\n";
  }
  
  return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
int main(){
  double n,x1,x2,x3,x4,y1,y2,y3,y4;
  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++: #pragma GCC optimize("O3")
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;

using ll = long long;
using P = pair<int, int>;
using T = tuple<int, int, int>;

template <class T> inline T chmax(T &a, const T b) {return a = (a < b) ? b : a;}
template <class T> inline T chmin(T &a, const T b) {return a = (a > b) ? b : a;}

constexpr int MOD = 1e9 + 7;
constexpr int inf = 1e9;
constexpr long long INF = 1e18;

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

typedef complex<double> Point, Vector;

#define X real()
#define Y imag()
#define EPS (1e-10)
#define equals(a, b) (fabs((a) - (b)) < EPS)

double cross(Vector a, Vector b){
    return a.X * b.Y - a.Y * b.X;
}

// 平行判定
bool isParallel(Vector a, Vector b){
    return equals(cross(a, b), 0);
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n; cin>>n;
    while(n--){
        double x1, y1, x2, y2, x3, y3, x4, y4; cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
        Vector v1 = Point(x1, y1) - Point(x2, y2), v2 = Point(x3, y3) - Point(x4, y4);
        cout << (isParallel(v1, v2) ? "YES" : "NO") << endl;
    }

    return 0;
}

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

typedef long long int ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pair<int, int> > vii;
#define rrep(i, m, n) for(int (i)=(m); (i)<(n);  (i)++)
#define erep(i, m, n) for(int (i)=(m); (i)<=(n); (i)++)
#define  rep(i, n)    for(int (i)=0; (i)<(n);  (i)++)
#define  rev(i, n)    for(int (i)=(n)-1; (i)>=0; (i)--)
#define vrep(i, c)    for(__typeof((c).begin())i=(c).begin(); i!=(c).end(); i++)
#define  ALL(v)       (v).begin(), (v).end()
#define mp            make_pair
#define pb            push_back
template<class T1, class T2> inline void minup(T1& m, T2 x){ if(m>x) m=static_cast<T2>(x); }
template<class T1, class T2> inline void maxup(T1& m, T2 x){ if(m<x) m=static_cast<T2>(x); }

#define INF 1000000000
#define MOD 1000000009
#define EPS 1E-12

template<class T> T add(T x, T y){ if(abs(x+y) < EPS*(abs(x)+abs(y))) return 0; return x + y; }
template<class T> inline bool semieq(T x, T y){ return abs(x - y) < EPS; }
template<class T> inline bool semige(T x, T y){ return x - y > -EPS; }
template<class T> inline bool semile(T x, T y){ return y - x > -EPS; }

template<class Type> struct Line;

template<class Type>
struct P
{
  friend struct Line<Type>;
private:
  complex<Type> z;

public:
  P(const Type x = 0, const Type y = 0) : z(complex<Type>(x, y)) { }
  void setter(Type x, Type y) { z = complex<Type>(x, y); }
  Type getX(){ return z.real(); }
  Type getY(){ return z.imag(); }
  inline double getSlope(){ return tan(z.arg()); }
  inline double getSlope(P<Type> p){ return (this - p).getSlope(); }

  bool operator == (const P<Type> p){ return  semieq(z.real(), p.real()) &&  semieq(z.imag(), p.imag()); }
  bool operator != (const P<Type> p){ return !semieq(z.real(), p.real()) || !semieq(z.imag(), p.imag()); }
  Type operator * (const P<Type> p){ return (z * p.z).real(); }
  Type operator / (const P<Type> p){ return (z * p.z).imag(); }
};

template<class Type>
struct Line
{
private:
  P<Type> S, T;

public:
  Line(const Type sx, const Type sy, const Type tx, const Type ty) : S(sx, sy), T(tx, ty) {}
  Line(const P<Type> S, const P<Type> T) : S(S), T(T) {}
  inline P<Type> getS(){ return S; }
  inline P<Type> getT(){ return T; }
  inline double getSlope(){ return S.getSlope(T); }
  inline bool isParallel(Line<Type> L){ return semieq(((L.S.z - L.T.z) / (S.z - T.z)).imag(), 0.0); }
  inline bool isVertical(Line<Type> L){ return semieq(((L.S.z - L.T.z) / (S.z - T.z)).real(), 0.0); }
};

typedef double Point;

int n;
P<Point> A[4];
Point x, y;

int main()
{
  cin >> n;

  while(n--){
    rep(i, 4){
      cin >> x >> y;
      A[i].setter(x, y);
    }
    Line<Point> AB(A[0], A[1]);
    Line<Point> CD(A[2], A[3]);
    puts(AB.isParallel(CD) ? "YES" : "NO");
  }

  return 0;
}