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 <queue>
#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 <fstream>
#include <complex>
using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<long, long> PLL;
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
//--------------------------------------------

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

const double EPS = 1e-8;
const double INF = 1e12;

typedef complex<double> P;
namespace std {
  bool operator < (const P& a, const P& b) {
    return real(a) != real(b) ? real(a) < real(b) : imag(a) < imag(b);
  }
}
double cross(const P& a, const P& b) {
  return imag(conj(a)*b);
}
struct L : public vector<P> {
  L(const P &a, const P &b) {
    push_back(a); push_back(b);
  }
};

bool intersectLL(const L &l, const L &m) {
  return abs(cross(l[1]-l[0], m[1]-m[0])) > EPS || // non-parallel
         abs(cross(l[1]-l[0], m[0]-l[0])) < EPS;   // same line
}

int main(){
	int n;
	cin>>n;
	REP(i,n){
		P p1,p2,p3,p4;
		cin>>p1.real()>>p1.imag()>>p2.real()>>p2.imag()>>p3.real()>>p3.imag()>>p4.real()>>p4.imag();
		L l1(p1,p2),l2(p3,p4);
		if(!intersectLL(l1,l2))cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
	}
	return 0;
}

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

using P = complex<long long>;

int cross(P p1, P p2) {
    return (p1.real() * p2.imag() - p1.imag() * p2.real());
}

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

C++: #include <iostream>
#include <cmath>
using namespace std;
int main(){
  

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

  return 0;

}

C++: #define _USE_MATH_DEFINES
 
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <math.h>

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 t1 = (y1-y2)*(x3-x4);
		double t2 = (y3-y4)*(x1-x2);

		if( (x1-x2)==0 && (x3-x4)==0 ){
			if( (x1-x2)==0 || (x3-x4)==0 ){
				cout << "NO" << endl;
			}else{
				cout << "YES" << endl;
			}
		}else if( (x1-x2)==0 || (x3-x4)==0 ){
			cout << "NO" << endl;
		}else if( t1==t2 ){
			cout << "YES" << endl;
		}else{
			cout << "NO" << endl;
		}
	}

	return 0;
}

C++: #include<iostream>

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;
		cout << (((y2 - y1) / (x2 - x1) == (y4 - y3) / (x4 - x3)) ? "YES\n" : "NO\n");
	}

	return 0;
}

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

int main() {
	int n;
	std::cin >> n;
	for (int i = 0; i < n; i++) {
		long double x1, y1, x2, y2, x3, y3, x4, y4, ax, ay, bx, by;
		std::cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		ax = x1 - x2; ay = y1 - y2;
		bx = x3 - x4; by = y3 - y4;
		if (ax == 0 || bx == 0) {
			if (ax == 0 && bx == 0) {
				std::cout << "YES" << std::endl;
			}
			else {
				std::cout << "NO" << std::endl;
			}
		}
		else{
			if ((ax / ay) == (bx / by)) {
				std::cout << "YES" << std::endl;
			}
			else {
				std::cout << "NO" << std::endl;
			}
		}
	}

	return 0;
}

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( ((y2-y1)/(x2-x1)) == ((y4-y3)/(x4-x3)) ) cout << "YES\n";
        else cout << "NO\n";
    }
    return 0;
}

C++: #include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <functional>
#include <string>
#include <algorithm>
#include <climits>
#include <utility>

#define PRINT(STR) cout << STR << endl;
#define REP(i, n) for (int (i) = 0; (i) < (int)(n); (i)++)
#define REG(i, a, b) for (int (i) = ((int)(a)); (i) < ((int)(b)); i++)
#define ALL(V) (V).begin(), (V).end()

typedef long long ll;

using namespace std;

int nextInt() { int n = -1; cin >> n; return n; }
double nextDouble() { double d = -1; cin >> d; return d; }
ll nextll() { ll n = -1; cin >> n; return n; }
string nextString() { string str; cin >> str; return str; }

int INF = 9999999;
double EPS = 1e-17;
// BEGIN //////////////////////////////////////////////////////////////


int main() {
	int N;
	scanf("%d", &N);
	double x1, y1, x2, y2, x3, y3, x4, y4;
	for (int i = 0; i < N; i++) {
		 scanf("%lf%lf%lf%lf%lf%lf%lf%lf",&x1,&y1,&x2,&y2,&x3,&y3,&x4,&y4);
		 double s = x1 - x2, t = y1 - y2, u = x3 - x4, v = y3 - y4;
		 if (s * v == t * u) {
			 PRINT("YES");
		 } else {
			 PRINT("NO");
		 }
	}

	return 0;
}

// END   //////////////////////////////////////////////////////////////

C++: #include <stdio.h>

int main(void) {
  int n, i, j;
  scanf("%d",&n);
  for(i = 0; i < n; ++i) {
    double a[8];
    for(j = 0; j < 8; ++j) scanf("%lf", &a[j]);
    a[3] -= a[1], a[2] -= a[0], a[6] -= a[4], a[7] -= a[5];
    if(a[3] / a[2] == a[7] / a[6] || a[3] / a[2] == -a[7] / a[6]) printf("YES\n");
    else printf("NO\n");
  }
  return 0;
}

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

#define EPS (1e-10)
#define EQ(a,b) (abs((a)-(b)) < EPS)
#define EQV(a,b) ( EQ( (a).real() , (b).real() ) && EQ( (a).imag(), (b).imag() ) )

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