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[1] == fpoints[3] {
			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>
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;
		if((x1-x2) * (x3 - x4) == (y1-y2) * (y3-y4)) cout << "YES" << endl;
		else cout << "NO" << endl;
	}
	return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<string>
using namespace std;
int main() {
	int n;
	cin >> n;
	for (int z = 0; z < n; z++) {
		long float x1, x2, x3,y1, y2, y3, y4, x4 ;
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		if (y1 > y2) {
			swap(y1, y2);
			swap(x1, x2);
		}
		if (y3 > y4) {
			swap(y3, y4);
			swap(x3, x4);
		}
		if ((x1 > x2&&x3 > x4 && ((y2 - y1) / (x1 - x2) == (y4 - y3) / (x3 - x4))) || (x2 > x1&&x4 > x3 && ((y1 - y2) / (x2 - x1) == (y3 - y4) / (x4 - x3)))) {
			cout << "YES" << endl;
		}
		else {
			cout << "NO" << endl;
		}
	}
}

C++: #include<iostream>

using namespace std;

int main(void)
{
	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 a1,a2;
		a1=(y2-y1)/(x2-x1);
		a2=(y4-y3)/(x4-x3);
		if(a1==a2)
		{
			cout<<"YES"<<endl;
		}
		else{
			cout<<"NO"<<endl;
		}
	}
}

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(x1 == x2 && x3 == x4){
			cout<<"YES"<<endl;
		}else if(y1 == y2 && y3 == y4){
			cout<<"YES"<<endl;
		}else{
			double m = (y2-y1)/(x2-x1);
			double n = (y4-y3)/(x4-x3);
			if(m==n){
				cout<<"YES"<<endl;
			}else if(m != n){
				cout<<"NO"<<endl;
			}
		}
	}
	return 0;
}

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

int main(){
	double x1,x2,x3,x4,y1,y2,y3,y4;
	int ans[100]={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);
		
		if(((y1-y2)/(x1-x2)-(y3-y4)/(x3-x4))==0.0)ans[i]=1;
		else if((x1-x2)==0 && (x3-x4)==0)ans[i]=1;
		else ans[i]=0;
	}
	
	for(i=0;i<n;i++){
		if(ans[i]==1)printf("YES\n");
		else printf("NO\n");
	}
	
return 0;
}

C++: #include <bits/stdc++.h>
#define rep(i,l,n) for(int i=l;i<n;i++)
using namespace std;

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

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

int main(int argc, char const* argv[]) {
  int n;
  cin >> n;
  for (int i = 0; i < n; i += 1) {
    float x1, y1, x2, y2, x3, y3, x4, y4;
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
    float AB, CD;
    AB = (y2 - y1) / (x2 - x1);
    CD = (y4 - y3) / (x4 - x3);
    if (AB == CD) cout << "YES" << endl;
    else cout << "NO" << endl;
  }
  return 0;
}

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

using namespace std;

int main() {

	int n;
	double x[4], y[4],ans[2];

	cin >> n;

	for (int i = 0; i < n; i++) {
		for (int j = 0; j < 4; j++) {
			cin >> x[j] >> y[j];
		}
		ans[0] = (y[1] - y[0]) / (x[1] - x[0]);
		ans[1] = (y[3] - y[2]) / (x[3] - x[2]);
		if (ans[0] == ans[1])
			cout << "YES" << endl;
		else
			cout << "NO" << endl;
	}

	return 0;
}

C++: #include<iostream>

using namespace std;

bool get_inc( double x1 , double y1 , double x2 , double y2 , double& a );

int main(void)
{
	double x1, x2, x3, x4;
	double y1, y2, y3, y4;

	double a1, a2;

	int n;

	cin >> n;

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

		bool result1 = get_inc( x1 , y1 , x2 , y2 , a1 );
		bool result2 = get_inc( x3 , y3 , x4 , y4 , a2 );

		if( result1 == false && result2 == false )
		{
			cout << "YES" << endl;
		}
		else
		{
			if( a1 - a2 <= 0.0000001 ) cout << "YES" << endl;
			else cout << "NO" << endl;
		}
	}


	return 0;
}

bool get_inc( double x1 , double y1 , double x2 , double y2 , double& a )
{
	a = ( y2 - y1 )/( x2 - x1 );
	if( x2 - x1 >= -0.0000001 && x2 - x1 <= 0.0000001 )
	{
		return false;
	}
	return true;
}

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

int main(){
    double x1, y1, x2, y2, x3, y3, x4, y4;

    int n;

    cin >> n;

    for(int i=1; i<=n; i++){
        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;
        }
    }
    return 0;
}

C++: #define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(v) v.begin(), v.end()
typedef long long ll;

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

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

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

C++: #include<cstdio>
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<map>
#include<stack>
#include<cstring>

using namespace std;

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

int main(){
	
	int n;
	cin>>n;
	
	rep(t,n){
		double x[4];
		double y[4];
		
		rep(i,4){
			cin>>x[i]>>y[i];
		}
		
		double dx1 = x[0]-x[1];
		double dx2 = x[2]-x[3];
		
		double dy1 = y[0]-y[1];
		double dy2 = y[2]-y[3];
		
		
		if(dx1==0){
			if(dx2==0)puts("YES");
			else puts("NO");
		}else{
			double a1 = dy1/dx1;
			double a2 = dy2/dx2;
			if(abs(a1-a2)<0.000000001)puts("YES");
			else puts("NO");
		}
	}
}

C++: #include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
using namespace std;
int main(){
	int n;
	double x1,y1,x2,y2,x3,y3,x4,y4;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
		double a,b,c,d,e,f;
		a=sqrt(pow(x2-x1,2)+pow(y2-y1,2));
		c=sqrt(pow(x4-x3,2)+pow(y4-y3,2));
		b=pow(abs(x1-x3),2);
		d=pow(abs(x2-x4),2);
		e=pow(abs(y1-y3),2);
		f=pow(abs(y2-y4),2);
		b=sqrt(b*e);
		d=sqrt(d*f);
		if(a==c&&b==d){
			cout<<"YES"<<endl;
		}else{
			cout<<"NO"<<endl;
		}
	}
	return 0;
}

C++: #include<iostream>
#include<vector>
using namespace std;
int main(){
	int n;
	cin >> n;
	for(int i=0;i<n;++i){
		vector<double> a(2),b(2),c(2),d(2);
		double tmp;
		cin>>a[0]>>a[1]>>b[0]>>b[1]>>c[0]>>c[1]>>d[0]>>d[1];
		double x1=b[0]-a[0],y1=b[1]-a[1];
		double x2=d[0]-c[0],y2=d[1]-c[1];
		if(x1*y2-x2*y1==0) cout << "YES" << endl;
		else cout << "NO" << endl;
	}
	return 0;
}

C++: #include <stdio.h>
 
int main() {
    double x1, x2, x3, x4, y1, y2, y3, y4;
    int n;
 
    int 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);
 
        if((x2 - x1) * (y4 - y3) - (y2 - y1) * (x4 - x3))
            printf("NO\n");
        else
            printf("YES\n");
    }
 
    return 0;
}