#include<iostream>
#include<string>
#include<vector>
#include<utility>
#include<queue>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<complex>
#define INF 1e9
#define llINF 9223372036854775807
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long

using namespace std;
const double eps=1e-10;
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(((abs(y1-y2)/abs(x1-x2))<=(abs(y3-y4)/abs(x3-x4))+eps)&&
((abs(y1-y2)/abs(x1-x2))>=(abs(y3-y4)/abs(x3-x4))-eps))
  cout<<"YES"<<endl;
 else
   cout<<"NO"<<endl;
}
return 0;
}

