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<cstdio>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<cmath>
#include<utility>
#include<set>
#include<complex>
#include<map>
#define vi vector<int>
#define vvi vector<vector<int> >
#define ll long long int
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
#define ld long double
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define CC puts("-------ok--------");
#define all(in) in.begin(), in.end()
using namespace std;
typedef pair<int, int> pii;
#define MAX 99999999
typedef pair<double,double> pdd;
int main(){
    pdd no1,no2,no3,no4;
    int n;cin>>n;
    rep(i,n){
        cin>>no1.first>>no1.second>>no2.first>>no2.second>>no3.first>>no3.second>>no4.first>>no4.second;
        double d1=(no2.second-no1.second)/(no2.first-no1.first);
        double d2=(no4.second-no3.second)/(no4.first-no3.first);
        if(d1==d2&&d1!=0)cout<<"YES"<<endl;
        else cout<<"NO"<<endl;
    }
}

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

int main(){
	int N;
	double x1, y1, x2, y2, x3, y3, x4, y4;
	double dx1, dy1, dx2, dy2;
	
	scanf("%d", &N);
	
	for(int i = 0; i < N; i++){
		scanf("%lf%lf%lf%lf%lf%lf%lf%lf", &x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4);
		dx1 = x2 - x1; dy1 = y2 - y1;
		dx2 = x4 - x3; dy2 = y4 - y3;
		if(dx1 * dy2 == dx2 * dy1) printf("YES\n");
		else printf("NO\n");
	}
	
	return 0;
}

C++: #include <stdio.h>

int
main(void)
{
	int n;

	scanf("%d", &n);

	float x1, y1, x2, y2, x3, y3, x4, y4;

	while (n--) {
		scanf("%f %f %f %f %f %f %f %f",
				   &x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4);

		if ((y2 - y1)/(x2 - x1) == (y4 - y3)/(x4 - x3)) {
			printf("YES\n");
		} else {
			printf("NO\n");
		}
	}

	return 0;
}

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

typedef double Real;
typedef complex<Real> Point;
typedef pair<Point,Point> Line;

const Real EPS=1e-8;


inline Point vec(const Line& a){
    return a.second-a.first;
}

Real dot(Point a,Point b){
    return (conj(a)*b).real();
}

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

inline int sgn(Real a,Real b=0){
    return a < b - EPS ? -1 : a > b + EPS ? 1 : 0;
}

inline bool near(Point a,Point b){
    return !sgn(abs(a-b));
}

inline bool is_orthogonal(Line la,Line lb){
    return !sgn(dot(vec(la),vec(lb)));
}

inline bool is_parallel(Line la,Line lb){
    return !sgn(cross(vec(la),vec(lb)));
}

inline bool is_intersected_line(Line la,Line lb){
    return !is_parallel(la,lb);
}

inline Real arg(const Point& base,const Point& a,const Point& b){
    return arg((b-base)/(a-base));
}

inline Real sr(Real a){
    return sqrt(max(a,(Real)0));
}

inline Real dist(Point a,Point b){
    return abs(a-b);
}

inline Real length(Point a){
    return abs(a);
}

inline Point unit_vector(Point a){
    return a / abs(a);
}


Point rotate(Point x,Real rad){
    return Point(x.real()*cos(rad)-x.imag()*sin(rad),x.real()*sin(rad)+x.imag()*cos(rad));
}                             



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

    int n;
    Point A[4];
    cin>>n;
    for(int i=0;i<n;i++){
        for(auto &t:A){
            double x,y;
            cin>>x>>y;
            t=Point(x,y);
        }

        Line la=make_pair(A[0],A[1]),lb=make_pair(A[2],A[3]);

        cout << (is_parallel(la,lb) ? "YES" : "NO") << endl;
    }

    return 0;
}

C++: #include <stdio.h>

int main(void) {
  int n, i, j;
  scanf("%d",&n);
  for(i = 0; i < n; ++i) {
    double a[8];
    for(j = 0; j < 8; ++j) scanf("%lf", &a[j]);
    a[3] -= a[1], a[2] -= a[0], a[6] -= a[4], a[7] -= a[5];
    if(a[3] * a[6] == a[7] * a[2]) printf("YES\n");
    else printf("NO\n");
  }
  return 0;
}

C++: #include <iostream>

using namespace std;

int main() {
	double x1,x2,x3,x4;
	double y1,y2,y3,y4;
	double incAB, incCD;
	int count=0;
	cin>>count;
	for(int i=0; i<count; i++) {
		cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
		incAB = (y2-y1) / (x2-x1);
		incCD = (y4-y3) / (x4-x3);
		if(incAB == incCD) cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
	}
	return 0;
}

C++: #include<iostream>
#include<cmath>
#include<cassert>
#include<cstdlib>
using namespace std;
#define EPS 0.0000001


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

  
      if ( abs((y2 - y1)*(x4 - x3) - (y4 - y3)*(x2 - x1) ) < EPS ) cout << "YES" << endl;
      else cout << "NO" << endl;
  }
}

C++: #include<stdio.h>

int main(){

int N;
double x1,x2,x3,x4,y1,y2,y3,y4;
double a1=0,a2=0;

scanf("%d",&N);
for(int i=0;i<N;i++)
{
scanf("%lf %lf %lf %lf %lf %lf %lf %lf",&x1,&y1,&x2,&y2,&x3,&y3,&x4,&y4);
a1=(x1-x2)*(y3-y4);a2=(x3-x4)*(y1-y2);
if(a1==a2)printf("YES\n");
else if(a1!=a2)printf("NO\n");
}
return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
using ld = long double;
const ld eps = 1e-14;

int main()
{
	int n;
	ld x1, x2, x3, x4, y1, y2, y3, y4;
	cin >> n;
	while (n--) {
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		ld dx1 = x2 - x1, dy1 = y2 - y1;
		ld dx2 = x4 - x3, dy2 = y4 - y3;
		if (abs(dx1 * dy2 - dy1 * dx2) < eps && dx1 * dx2 + dy1 * dy2 > eps) {
			puts("YES");
		}
		else {
			puts("NO");
		}
	}
	return 0;
}

C++: #include<stdio.h>
#include<math.h>

int main(){
	double x1,x2,x3,x4,y1,y2,y3,y4;
	double a1=0.0,a2=0.0;
	int n,i;
	
	scanf("%d",&n);
	
	for(i=0;i<n;i++){
		scanf("%lf %lf %lf %lf %lf %lf %lf %lf",&x1,&y1,&x2,&y2,&x3,&y3,&x4,&y4);
			a1=(y1-y2)/(x1-x2);
			a2=(y3-y4)/(x3-x4);
		
			if( a1==a2 )printf("YES\n");
			else printf("NO\n");
	}
return 0;
}

C++: // 2014/07/21 Tazoe

#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;

//		int X1 = (int)(x1*100000.0);
//		int Y1 = (int)(y1*100000.0);
//		int X2 = (int)(x2*100000.0);
//		int Y2 = (int)(y2*100000.0);
//		int X3 = (int)(x3*100000.0);
//		int Y3 = (int)(y3*100000.0);
//		int X4 = (int)(x4*100000.0);
//		int Y4 = (int)(y4*100000.0);

//		long long ABX = X2-X1;
//		long long ABY = Y2-Y1;
//		long long CDX = X4-X3;
//		long long CDY = Y4-Y3;

		double abx = x2-x1;
		double aby = y2-y1;
		double cdx = x4-x3;
		double cdy = y4-y3;

		if(fabs(abx*cdy-aby*cdx)<0.0000000001){
			cout << "YES" << endl;
		}
		else{
			cout << "NO" << endl;
		}
	}

	return 0;
}

C++: #include <iostream>
using namespace std;
#define rep(i,x) for(int i = 0; i < (x); ++(i))
int main() {
	int n;
	cin >> n;
	while(n--) {
		double x[4], y[4];
		double EPS = 1e-10;
		rep(i,4) {
			cin >> x[i] >> y[i];
		}
		if((x[1] - x[0]) * (y[3] - y[2]) - (x[3] - x[2]) * (y[1] - y[0]) > EPS) {
			cout << "NO" << endl;
		} else cout << "YES" << endl;
	}
	return 0;
}