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 <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]))*((a[1]-a[3])*(a[4]-a[6])-(a[5]-a[7])*(a[0]-a[2]))<0.0000000000000000001){
			cout<<"YES"<<endl;
		}else{
			cout<<"NO"<<endl;
		}
	}

}

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.0001;
}

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 <iostream>
#include <algorithm>
#include <cstdio>
using namespace std;

int main() {
	int n;
	double x1,x2,x3,x4,y1,y2,y3,y4,m,l;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
		double a=y2-y1; double b=x2-x1;
		double d=y4-y3; double e=x4-x3;
 
		if(a*e-d*b==0) 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;
  double ang_ab, ang_cd;
  int i, n;

  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> x1 >> y1 >> x2 >> y2
        >> x3 >> y3 >> x4 >> y4;
		if (x1 == x2 && x3 == x4) {
      cout << "YES" << endl;
			break;    
    }

    ang_ab = (y1 - y2) / (x1 - x2);
    ang_cd = (y3 - y4) / (x3 - x4);

    if (ang_ab == ang_cd) {
      cout << "YES" << endl;
    } else {
      cout << "NO"  << endl;
    }
  }

  return 0;
}

C++: #include<cmath>
#include<iostream>
#include<algorithm>
#include<iomanip>
#include<vector>
#include<string>
#include<queue>
#include<stack>
#include<cstdio>
#include<map>
#define rep(i,n) for(int i=0;i<n;i++)
#define fori(i,k,n) for(int i=k;i<n;i++)
using namespace std;
const int dx[4] = { 0, 1, 0, -1 }, dy[4] = { 1, 0, -1, 0 };
const int dX[8] = { 0, 1, 1, 1, 0, -1, -1, -1 }, dY[8] = { 1, 1, 0, -1, -1, -1, 0, 1 };
/*
(char)'1' - (int)48 = (int)1; 


*/


int main()
{
	int n;
	cin >> n;
	while (n--){
		double x[4], y[4];
		rep(i, 4)cin >> x[i]>>y[i];
		rep(i, 4)
		{
			x[i] += 0.000001;
			y[i] += 0.000001;;

		}
		if ((x[0] - x[1])*(y[2] - y[3]) == (x[2] - x[3])*(y[0] - y[1]))
			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;
  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 <cstdio>

using namespace std;

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

int main()
{
    int n; scanf( "%d\n", &n );
    while( n > 0 )
    {
        scanf("%lf %lf %lf %lf %lf %lf %lf %lf\n", &x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4 );
        double dx1 = x2 - x1, dx2 = x4 - x3, dy1 = y2 - y1, dy2 = y4 - y3, det = dx1 * dy2 - dx2 * dy1;

        if( det < 0.0000001 )
        {
            printf( "YES\n" );
        }
        else
        {
            printf( "NO\n" );
        }

        /* if( (dx1 == 0 && dx2 == 0) || (dy1 == 0 && dy2 == 0 ) )
        {
            printf( "YES\n" );
        }
        else if( dx1 != 0 && dx2 != 0 )
        {
            dy1 /= dx1;
            dy2 /= dx2;
            if( dy1 == dy2 || dy1 == -dy2 )
            {
                printf( "YES\n" );
            }
        }
        else
        {
            printf( "NO\n" );
        }
         */
        n--;
    }
    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/dx1 == dy2/dx2)
      cout<<"YES"<<endl;
    else
      cout<<"NO"<<endl;
  }
}

C++: //AOJ 0021
#include <stdio.h>
//x???y?????????????????????????????????????????????
int main(){
    double x1,y1,x2,y2,x3,y3,x4,y4;
    double m1,m2;
    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);
    	m1=(y2-y1)/(x2-x1);
    	m2=(y4-y3)/(x4-x3);
    	if(m1==m2)puts("YES");
    	else puts("NO");
    	}
	}
	return 0;
}

C++: #include <cstdio>

using namespace std;

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

int main()
{
    int n; scanf( "%d\n", &n );
    while( n > 0 )
    {
        scanf("%lf %lf %lf %lf %lf %lf %lf %lf\n", &x1, &y1, &y2, &y2, &y3, &y3, &y4, &y4 );
        double dx1 = x2 - x1, dx2 = x4 - x3, dy1 = y2 - y1, dy2 = y4 - y3;
        if( (dx1 == 0 && dx2 == 0) || (dy1 == 0 && dy2 == 0 ) )
        {
            printf( "YES\n" );
        }
        else if( dx1 != 0 && dx2 != 0 )
        {
            dy1 /= dx1;
            dy2 /= dx2;
            if( dy1 == dy2 || dy1 == -dy2 )
            {
                printf( "YES\n" );
            }
        }
        else
        {
            printf( "NO\n" );
        }
        
        n--;
    }
    return 0;
}

C++: #include <iostream>
#include <stdio.h>
#include <string>
#include <math.h>
#include <algorithm>
#include <vector>

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 AB = (y2-y1) / (x2-x1);
		double CD = (y4-y3) / (x4-x3);

		if(y2-y1 == 0) AB = 0;
		if(y4-y3 == 0) CD = 0;

		if(AB - CD < 0.000001){
			cout << "YES" << endl;
		}
		else{
			cout << "NO" << endl;
		}

	}
	return 0;
}