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")
		} else {
			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 <fstream>
#include <stdio.h>
#include <stdlib.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include<string>
#include<vector>
#include<cmath>
#include<stack>
#include<queue>
#include<sstream>
#include<algorithm>
#include<map>
#include<complex>
using namespace std;


#define li			long long int
#define rep(i,to)	for(int i=0;i<((int)(to));i++)
#define repp(i,start,to)	for(int i=(int)(start);i<((int)(to));i++)
#define pb			push_back
#define sz(v)		((li)(v).size())
#define bgn(v)		((v).begin())
#define eend(v)		((v).end())
#define allof(v)	(v).begin(), (v).end()
#define dodp(v,n)		memset(v,(li)n,sizeof(v))
#define bit(n)		(1ll<<(li)(n))
#define mp(a,b)		make_pair(a,b)
#define rin	rep(i,n)
#define EPS 1e-10
#define ETOL 1e-8
#define MOD 1000000007
#define p2(a,b)		cout<<a<<"\t"<<b<<endl
#define p3(a,b,c)		cout<<a<<"\t"<<b<<"\t"<<c<<endl

double a[8];

void solve(){
	double dx1=a[2]-a[0];
	double dx2=a[6]-a[4];
	double dy1=a[3]-a[1];
	double dy2=a[7]-a[5];
	bool ans;
	
	if(dx1==0)ans=(dx2==0);
	ans=(dx2!=0 && dy1/dx1==dy2/dx2);
	if(ans) puts("YES");
	else puts("NO");
}

int main(){
	li n;
	cin>>n;
	
	rin{
		rep(i,8)cin>>a[i];
		solve();
	}
	
	return 0;
}

C++: #include <iostream>
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;
    cin >> n;
    double x1, y1, x2, y2, x3, y3, x4, y4;
    for(int i = 0; i < n; i++){
    	cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
    	vec v1 = P(x1, y1);
    	vec v2 = P(x2, y2);
    	vec v3 = P(x3, y3);
    	vec v4 = P(x4, y4);
    	vec a = sub(v1, v2);
    	vec b = sub(v3, v4);
    	if (cross(a, b) == 0)
    		cout << "YES" << endl;
    	else
    		cout << "NO" << endl;
    }
    return 0;

}

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

int main(int argc, const char * argv[]) {
    std::vector<int> r;
    int num;
    std::cin >> num;
    int xa,ya,xb,yb,xc,yc,dx,dy;
    int a,b;
    for(int i = 0;i < num;i++){
        std::cin >> xa >> ya>> xb >> yb >> xc >> yc >> dx >> dy;
        a = (yb - ya) / (xb - xa);
        b = (dy - yc) / (dx - xc);
        if(a == b){
            printf("YES");
        }else{
            printf("NO");
        }
    }
    
    }

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

using namespace std;

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

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

        da = (y2 - y1) * (x4 - x3) - (y4 - y3) * (x2 - x1);
        if(fabs(da) < 1e-10) { da = 0.0; }

        if(da == 0.0) { cout << "YES" << endl; }
        else { cout << "NO" << endl; }
    }

    return 0;
}

C++: #include <iostream>

using namespace std;

float FindGradient(float a1, float b1, float a2, float b2)
{
    return (b2 - b1)/(a2 - a1);
}

int main()
{
    int T;
    string Result[100];
    cin >> T;

    for(int a = 0; a < T; a++)
    {
        float x1,x2,x3,x4,y1,y2,y3,y4;
        float M1,M2;

        cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
        M1 = FindGradient(x1,y1,x2,y2);
        M2 = FindGradient(x3,y3,x4,y4);

        if(M1 == M2)
        {
            Result[a] = "YES";
        }
        else
        {
            Result[a] = "NO";
        }
    }

    for(int b = 0; b < T; b++)
    {
        cout << Result[b] << endl;
    }
}

C++: #include <cstdio>
#include <cstring>
#include <string>
#include <cmath>
#include <cassert>
#include <iostream>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <bitset>
#include <functional>
#include <sstream>
#include <utility>
#include <cstdlib>
#include <cctype>
#include <climits>
#include <fstream>

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<pair<int, int> > vpii;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) for(int i=0;i<(n);++i)
#define foreach(itr,c) for(__typeof(c.begin()) itr=c.begin(); itr!=c.end(); itr++)
#define dbg(x) cout << #x"="<< (x) << endl
#define mp(a,b) make_pair((a),(b))
#define pb(a) push_back(a) 
#define in(x) cin >> x;
#define all(x) (x).begin(), (x).end()
#define INF 2147483600
#define fi first
#define se second
using namespace std;

int main(){
	int N;
	vd a(8);
	cin >> N;
	rep(i,N){
		rep(i,8){
			cin>>a[i];
		}
		if((a[1]-a[3])*(a[4]-a[6])==(a[5]-a[7])*(a[0]-a[2])){
			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");
	}
	
	return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
  int n;
  double xa,ya,xb,yb,xc,yc,xd,yd,a2,a1;
  while(1){
    cin>>n;
    for(int i=0;i<n;i++){
      cin>>xa>>ya>>xb>>yb>>xc>>yc>>xd>>yd;
      a1=(yb-ya)/(xb-xa);
      a2=(yd-yc)/(xd-xc);
      if(a1==a2)cout<<"YES"<<endl;
      else cout<<"NO"<<endl;
    }
  }
  return 0;
}

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&&x3==x4) cout<<"YES"<<endl;
     else 
     {
       double k1=(y2-y1)/(x2-x1);
       double k2=(y4-y3)/(x4-x3);
       if(k1==k2) cout<<"YES"<<endl;
       else cout<<"NO"<<endl;     
     }          
   }
   //while(1);      
   return 0;    
 }

C++: #include <iostream>

using namespace std;

typedef struct myvector{
  double x;
  double y;
}Vector;

Vector sub_vector(Vector& a, Vector& b)
{
  Vector ret;
  ret.x = b.x - a.x;
  ret.y = b.y - a.y;
  return ret;
}

double cross_product(Vector& a, Vector& b)
{
  return a.x * b.y - b.x * a.y;
}

int main()
{
  int n;
  Vector A, B, C, D;
  cin >> n;
  for(int i = 0; i < n; i++){
    cin >> A.x >> A.y >> B.x >> B.y >> C.x >> C.y >> D.x >> D.y;
    Vector AB = sub_vector(A, B);
    Vector CD = sub_vector(C, D);
    if(cross_product(AB, CD) == 0.0)
      cout << "YES" << endl;
    else 
      cout << "NO" << endl;
  }
}

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