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++: #define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <sstream>
#include <utility>
using namespace std;
//typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;
#define all(c) (c).begin(), (c).end()
#define loop(i,a,b) for(int i=a; i<b; i++)
#define rep(i,b) loop(i,0,b)
#define each(e,c) for(auto&e:c)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define lb lower_bound
#define ub upper_bound
#ifdef DEBUG
#define dump(...) (cerr<<#__VA_ARGS__<<" = "<<(DUMP(),__VA_ARGS__).str()<<" ["<<__LINE__<<"]"<<endl)
struct DUMP:ostringstream{template<class T>DUMP &operator,(const T&t){if(this->tellp())*this<<", ";*this<<t;return *this;}};
#else
#define dump(...)
#endif
 
int main(){
    int n; cin>>n;
    rep(_,n){
        double x[2][2], y[2][2];
        rep(i,2){
            rep(j,2){
                double x_,y_;
                cin >> x_ >> y_;
                x[i][j] = x_;
                y[i][j] = y_;
            }
        }
        double dx1=x[0][0]-x[0][1], dy1=y[0][0]-y[0][1];
        double dx2=x[1][0]-x[1][1], dy2=y[1][0]-y[1][1];
        //dump(dx1,dx2,dy1,dy2);
        puts(dx1*dy2==dx2*dy1 ? "YES" : "NO");
    }
}

C++: #include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define LOOP(i,x,n) for(int i=x;i<n;i++)
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define MP make_pair
#define FR first
#define SC second
#define int long long
const double eps=1e-9;
using namespace std;
const int MOD=1000000007;
const int INF=9000000009;

signed main(){
  int n;
  cin>>n;
  while(n--){
    double x1,y1,x2,y2,x3,y3,x4,y4;
    cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
    double a=(y2-y1)/(x2-x1),b=(y4-y3)/(x4-x3);
    cout<<(a==b?"YES":"NO")<<endl;
  }
  return 0;
}

C++: #include <iostream>
using namespace std;
int main(){
  
  double x1, y1, x2, y2, x3, y3, x4, y4;
  int dataSets;
  cin >> dataSets;
  for(int i=0;i<dataSets;i++){
    bool flag=false;
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
    if((y2-y1)*(x4-x3) - (x2-x1)*(y4-y3)==0){
      flag = true;
    }

    if(flag){
      cout << "YES" << endl;
    }else{
      cout << "NO" << endl;
    }
    
  }

}

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){
		 scanf("%lf %lf %lf %lf %lf %lf %lf %lf", &x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4);
		//cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
		if((y1-y2)*(x3-x4) == (x1-x2)*(y3-y4) ){
			cout << "YES" << endl;
		}else{
			cout << "NO" << endl;
		}
	}
	return 0;
}

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-no2.first);
        if(d1==d2&&d1!=0)cout<<"YES"<<endl;
        else cout<<"NO"<<endl;
    }
}

C++: #include<iostream>
#include<complex>
using namespace std;
#define dff 1e-10
int main(){
  int n;
  cin >>n;
  while(n--){
    double x;
    complex<double> a[4];
    for(int i=0; i<4; i++) cin >>a[i].real()>>a[i].imag();
    for(int i=0; i<2; i++) a[i*2]-=a[i*2+1];
    x = a[0].real()*a[2].imag()-a[0].imag()*a[2].real();
    if(-dff<x && x<dff) cout <<"YES"<<endl;
    else cout <<"NO"<<endl;
  }
  return 0;
}

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

using namespace std;

int main(void) {
	int ds;
	while( cin >> ds ) {
		for(int i = 0; i < ds; i++) {
			double X[4], Y[4];
			double a1, a2;
			double b1, b2;
			
			for(int j = 0; j < 4; j++) {
				cin >> X[j] >> Y[j];
			}
			a1 = abs(Y[1] - Y[0]);
			b1 = (X[1] - X[0]);
			
			a2 = abs(Y[3] - Y[2]);
			b2 = (X[3] - X[2]);
			
			a1 /= b1;
			a2 /= b2;
			
			if(a1 == a2) {
				cout << "YES" << endl;
			} else {
				cout << "NO" << endl;
			}
		}
	}
	return 0;
}

C++: #include <iostream>

using namespace std;

int main(void){

  double x1,x2,x3,x4;
  double y1,y2,y3,y4;
  
  int n;
  cin >> n;
  while(n--){

    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;

    double katamuki1,katamuki2;
    katamuki1 =   ( y2 - y1 ) / ( x2 - x1 );
    katamuki2 =   ( y4 - y3 ) / ( x4 - x3 );
    if( katamuki1 == katamuki2 )cout << "YES" << endl;
    else cout << "NO" << endl;
  }
  return 0;
}

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


int main() {
  int n;
  cin >> n;
  while (n--) {
    double x[4], y[4];
    double eps = 1e-15;
    for (int i = 0; i < 4; i++) cin >> x[i] >> y[i];
    if (((abs(y[3] - y[2]) < eps && abs(x[3] - x[2]) < eps)) || (abs(x[1] - x[0]) < eps && abs(y[1] - y[0]) < eps)) {
      cout << "NO" << endl;
    } else if (abs((y[3] - y[2]) * (x[1] - x[0]) - (y[1] - y[0]) * (x[3] - x[2])) < eps) {
      cout << "YES" << endl;
    } else {
      cout << "NO" << endl;
    }
  }
  return 0;
}

C++: #define	_USE_MATH_DEFINES
#include <iostream>
#include <algorithm>
#include <functional>
#include <vector>
#include <cstdio>
#include <string>
#include <cmath>
#include <cfloat>
#include <map>
#include <queue>
#include <stack>
#include <list>
using namespace std;

int main(){

	int n;
	cin>>n;
	double x1,y1,x2,y2,x3,y3,x4,y4;
	while(n>0){
		
	 cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;

		
		if((y4-y3)/(x4-x3)==(y2-y1)/(x2-x1))
			cout<<"YES"<<endl;
		else
			cout<<"NO"<<endl;
		
		n--;
	}
	
	
}

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

int main() {
	double x[4], y[4], m[2];
	int i, n;
	cin >> n;
	while (n--) {
		for (i = 0; i < 4; i++)
			cin >> x[i] >> y[i];
		if (x[0] == x[1] && x[2] == x[3])
			cout << "YES" << endl;
		else if (x[0] != x[1] && x[2] != x[3]) {
			m[0] = (y[1]-y[0]) / (x[1]-x[0]);
			m[1] = (y[3]-y[2]) / (x[3]-x[2]);
			if (m[0] == m[1])
				cout << "YES" << endl;
			else
				cout << "NO" << endl;
		} else
			cout << "NO" << endl;
	}
	return 0;
}