Go: package main

import "fmt"

func abs(x float64) float64 {
	if x < 0 {
		return -x
	}
	return x
}

func main() {
	var n int
	var x1, y1, x2, y2, x3, y3, x4, y4 float64
	fmt.Scan(&n)
	for i := 0 ; i < n; i++ {
		fmt.Scanf("%f %f %f %f %f %f %f %f", &x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4)
		if abs((x2-x1)*(y4-y3) - (y2-y1)*(x4-x3)) < 1e-10 {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

C++: //include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <queue>

using namespace std;

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-8;
const double PI  = acos(-1.0);

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

  int N; cin >> N;
  REP(n,N){
	double x[4], y[4];
	REP(i,4)
	  cin >> x[i] >> y[i];
	x[0] -= x[1], y[0] -= y[1], x[2] -= x[3], y[2] -= y[3];

	if(abs(x[0]*y[2]-x[2]*y[0]) < EPS)
	  cout << "YES" << endl;
	else
	  cout << "NO" << endl;
  }
  
  return 0;
}

C++: #include <cstdio>
#include <vector>
#include <algorithm>
#include <cstring>
#include <string>
#include <cctype>
#include <sstream>
#include <cmath>

using namespace std;

#define reep(i,f,n) for(int i=f; i<int(n); ++i)
#define rep(i,n) reep(i,0,n)

#define EPS 1e-10
#define EQUAL(a, b) (fabs((a)-(b))<EPS)

typedef vector<int> vi;

int main()
{
	int n;
	scanf("%d", &n);
	rep(i, n){
		double x1, y1, x2, y2, x3, y3, x4, y4;
		scanf("%lf%lf%lf%lf%lf%lf%lf%lf", &x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4);
		puts(EQUAL((x2-x1)*(y4-y3), (y2-y1)*(x4-x3)) ? "YES" : "NO");
	}

	return 0;
}

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

C++: #include <functional>
#include <algorithm>
#include <iostream>
#include <numeric>
#include <iomanip>
#include <utility>
#include <cstdlib>
#include <sstream>
#include <bitset>
#include <vector>
#include <cstdio>
#include <ctime>
#include <queue>
#include <deque>
#include <cmath>
#include <stack>
#include <list>
#include <map>
#include <set>

using namespace std;


#define rep(i,n) for(int i=0;i<(n);i++)

const double EPS = 1e-6;
const double INF = 100000000;




int main(){
    int n;
    cin>>n;
    rep(i,n){
        double x[4],y[4],ax,ay,bx,by,ans;
        
        rep(j,4){
            cin>>x[j]>>y[j];
        }
        
        ax=x[1]-x[0];
        ay=y[1]-y[0];
        bx=x[3]-x[2];
        by=y[3]-y[2];
        
        ans=ax*by-bx*ay;
        if(ans==0)cout<<"YES"<<endl;
        else cout<<"NO"<<endl;
        
    }

    return 0;
}

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

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

C++: #include <bits/stdc++.h>
#define int long long
#define ll long long
#define rep(i,n) for(int i=0;i<n;i++)
#define INF (((ll)1<<31)-1)
#define eps LDBL_EPSILON
#define moder (1000000007)
#define pie 3.141592653589793238462643383279
#define P std::pair<int,int>
#define prique priority_queue
#define ggr getchar();getchar();return 0;
using namespace std;
int n;
double b[8];
int a[8];
int gcd(int x,int y){
	if(y==0)return x;
	return gcd(y,x%y);
}
signed main(){
	cin>>n;
	rep(i,n){
		rep(j,8){
			cin>>b[j];
			a[j]=b[j]*1000000;
		}
		int A=a[2]-a[0],B=a[3]-a[1],C=a[6]-a[4],D=a[7]-a[5];
		if(A*D==B*C)puts("YES");
		else puts("NO");
	}
	return 0;
}

C++: #include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cctype>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <string>
#include <iostream>
#include <sstream>
#include <functional>
#include <utility>

using namespace std;

#define rep(i,n) for(int i=0;i<(int)(n);i++)

short n, i, j;
double a[4], b[4];
int d[4], e[4];

int main(){
	scanf("%d", &n);
	rep(i, n){
		rep(j, 4){
			scanf("%lf %lf", &a[j], &b[j]);
			d[j] = a[j] * 10000;
			e[j] = b[j] * 10000;
		}
		if(d[1] - d[0] == d[3] - d[2] && e[1] - e[0] == e[3] - e[2]) printf("YES\n");
		else printf("NO\n");
	}
	return 0;
}

C++: #include <iostream>
using namespace std;
#define INF 1e+15

int main(){
	double x1, x2, x3, x4, y1, y2, y3, y4;
	int n;
	cin >> n;
	while( n-- ){
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		double tan1, tan2;
		/*if( x1 - x2 == 0 ){
			tan1 = INF;
		}else{
			tan1 = (y1-y2) / max((x1-x2), -1*(x1-x2));
		}
		if( x3 - x4 == 0 ){
			tan2 = INF;
		}else{
			tan2 = (y3-y4) / max((x3-x4), -1*(x3-x4));
		}*/
		tan1 = (x1-x2)*(y3-y4);
		tan2 = (x3-x4)*(y1-y2);
		if( tan1 == tan2 ) cout << "YES" << endl;
		else cout << "NO" << endl;
	}
}

C++: #include <iostream>
#include <cmath>
using namespace std;
#define EPS 1e-10

int main(){
  int n;
  double x1,x2,x3,x4,y1,y2,y3,y4;
  cin >> n;
  while(n--){
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
    if(fabs((y2-y1)/(x2-x1) - (y4-y3)/(x4-x3)) < EPS) cout << "YES" << endl;
    else cout << "NO" << endl;
  }
}

C++: #include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int main(void){
    int n;
    double x1,x2,x3,x4,y1,y2,y3,y4;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
 
 
    double a,b;
    a=(y2-y1)/(x2-x1);
    b=(y4-y3)/(x4-x3);
    (a==b)? cout<<"YES"<<endl : cout<<"NO"<<endl;
    }
    return 0;
}

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

int main() {
double x1,x2,x3,x4,y1,y2,y3,y4;
int n;
cin>>n;
for(int jjj=1;jjj<=n;jjj++){
	cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
	if(x1==x2){
		if(x3==x4){
			cout<<"YES"<<endl;
		}
		else{
			cout<<"NO"<<endl;
		}}
	else{
		if((y2-y1)/(x2-x1)==(y4-y3)/(x4-x3)||(y2-y1)/(x2-x1)==(y4-y3)/(x4-x3)){
			cout<<"YES"<<endl;
		}
		else{
			cout<<"NO"<<endl;
		}
	}	
	}

	return 0;
}