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<queue>
#include<string>
#include<stack>
#include<cstdio>
#include<algorithm>

using namespace std;

int main(void)
{
  double x,y,x2,y2;
  double x1,y1,x3,y3;
  int n;
  int i;
  long double a=0,b=0;
  int k=0;
  int j=0;

  cin>>n;

  for(i=0;i<n;i++)
    {
      cin>>x>>y>>x1>>y1;
      cin>>x2>>y2>>x3>>y3;

      if(x1-x!=0.0)
	{
          a=(y1-y)*(x3-x2);
          j++;
        }
      else
        k++;


      if(x3-x2!=0.0)
        {
          b=(y3-y2)*(x1-x);
          j++;
        }
      else
        k++;

      if((a==b && j==2) || k==2)
        puts("YES");
      else
        puts("NO");
    }

}

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

struct point{
	double x;
	double y;
};

struct line{
	point p1;
	point p2;
};

bool parallel(line l1, line l2){
	double dx1 = l1.p2.x - l1.p1.x;
	double dy1 = l1.p2.y - l1.p1.y;
	double dx2 = l2.p2.x - l2.p1.x;
	double dy2 = l2.p2.y - l2.p1.y;
	if(dy2 * dx1 == dy1 * dx2) return true;
	else return false;
}

int main(){
	line l1, l2;
	int n;
	cin >> n;
	for(int i = 0; i < n; i++){
		cin >> l1.p1.x >> l1.p1.y >> l1.p2.x >> l1.p2.y
			>> l2.p1.x >> l2.p1.y >> l2.p2.x >> l2.p2.y;
		if(parallel(l1,l2)) cout << "YES" << endl;
		else cout << "NO" << endl;
	}
	return 0;
}

C++: #include <iostream>
#define REP(i,n) for(int i = 0; i < (n); ++i)
using namespace std;

int main(){
	int n;
	cin >> n;
	double x1,y1,x2,y2,x3,y3,x4,y4;
	REP(i,n){
		cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
		if((y2-y1)*(x4-x3) == (x2-x1)*(y4-y3) ){
			cout << "YES" << endl;
		}else{
			cout << "NO" << endl;
		}
	}
	return 0;
}

C++: #define _CRT_SECURE_NO_WARNINGS
#include<cstdio>
#include<cmath>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<utility>
#include<iomanip>
#include<vector>
#include<string>
#include<queue>
#include<stack>
#include<map>
#include<list>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define repp(i,k,n) for(int i=k;i<(int)n;i++)
#define F first
#define S second
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 };
struct XY
{
	int x;
	int y;
};
int in()
{
	int x;
	cin >> x;
	return x;
}

/*
(char)'1' - (int)48 = (int)1;
　1111181
*/
////////////////////////////////////////////////////
int main()
{
	int n;
	cin >> n;
	rep(EEE, n)
	{
		double x1, x2, x3, x4, y1, y2, y3, y4;
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		if ((x1 - x2)*(y3*y4) == (x3 - x4)*(y1 - y2))cout << "YES" << endl;
		else cout << "NO" << endl;

	}

}

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

using namespace std;
#define EPS 0.0000001
int main(){

	int n; cin >> n;
	double x1,x2,x3,x4,y1,y2,y3,y4; //??\????????§?¨?

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

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

typedef struct vec{
    double x;
    double y;
}vec_s;

int main(void){
    int n = 0;
    cin >> n;
    for(int i = 0; i < n; i++){
        double Point[8];
        for(int j = 0; j < 8; j++){
            Point[j] = 0;
        }
        for(int j = 0; j < 8; j++){
            cin >> Point[j];
        }
        vec_s V0 = {Point[0], Point[1]};
        vec_s V1 = {Point[2], Point[3]};
        vec_s V2 = {Point[4], Point[5]};
        vec_s V3 = {Point[6], Point[7]};
        vec_s a = {(V0.x - V1.x), (V0.y - V1.y)};
	    vec_s b = {(V2.x - V3.x), (V2.y - V3.y)};
	    if ((a.x * b.y - a.y * b.x) == 0){
	    		cout << "YES" << endl;
	    	}
	    	else{
	    		cout << "NO" << endl;
	    	}
    }
}

C++: #include <iostream>
#include <fstream>
#include <typeinfo>
#include <vector>
#include <cmath>
#include <set>
#include <map>
#include <string>
#include <algorithm>
#include <cstdio>
#include <queue>
#include <iomanip>
#include <cctype>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<25;
const double pi=acos(-1);
const double eps=1e-8;
const vi emp;

double add_double(double a,double b){
	if(abs(a+b)<eps*(abs(a)+abs(b))) return 0;
	return a+b;
}

struct point{
	double x,y;
	point operator+(point p){
		return point{add_double(x,p.x),add_double(y,p.y)};
	}
	point operator-(point p){
		return point{add_double(x,-p.x),add_double(y,-p.y)};
	}
	point operator*(double p){
		return point{x*p,y*p};
	}
	point operator/(double p){
		if(!p) return point{0,0}; 
		return point{x/p,y/p};
	}
	bool operator==(point p){
		return fabs(add_double(x,-p.x))<eps&&fabs(add_double(y,-p.y))<eps;
	}
	bool operator<(point p){
		if(fabs(x-p.x)>eps) return x<p.x;
		return y<p.y;
	}
};

typedef pair<point,point> pp;
typedef vector<point> VP;
const point O{0,0};

class Geom{
	public:
	double Length(point x,point y){
		point z=y-x;
		return sqrt(z.x*z.x+z.y*z.y);
	}
	double IP(point p,point q){
		return p.x*q.x+p.y*q.y;
	}
	double CP(point p,point q){
		return p.x*q.y-q.x*p.y;
	}
	string Counter_Clockwise(pp a,point x){
		point A=a.second-a.first;
		point X=x-a.first;
		double ip=IP(A,X),cp=CP(A,X),Al=Length(O,A),Xl=Length(O,X);
		if(cp>eps) return "Counter_Clockwise";
		if(cp<-eps) return "Clockwise";
		if(ip<-eps) return "Online_Back";
		if(Xl<Al||fabs(Xl-Al)<eps) return "On_Segment";
		return "Online_Front";
	}
	string Parallel_Orthogonal(pp a,pp b){
		point A=a.second-a.first,B=b.second-b.first;
		double ip=IP(A,B),cp=CP(A,B);
		string f=Counter_Clockwise(pp(a.first,a.second),b.first),s=Counter_Clockwise(pp(a.first,a.second),b.second);
		if(f[0]!='C'&&s[0]!='C') return "Agreement";
		if(cp<eps&&cp>-eps) return "Parallel";
		if(ip<eps&&ip>-eps) return "Orthogonal";
		else return "Commonly";
	}
	void Point_in(point& p){
		cin>>p.x>>p.y;
	}
};

int n;
VP p(4);
string s;

int main(){
	Geom geo;
	cin>>n;
	for(int i=0;i<n;i++){
		for(VP::iterator i=p.begin();i!=p.end();i++) geo.Point_in(*i);
		s=geo.Parallel_Orthogonal(pp(p[0],p[1]),pp(p[2],p[3]));
		if(s[0]=='P') cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
	}
}