#include <iostream>
using namespace std;

int main()
{
    double a,s,d,f,g,h,j,k;
    double q,w,e,r;
        int n;
    cin>>n;
    for(int i=0; i<n; i++){
        cin>>a>>s>>d>>f>>g>>h>>j>>k;
        q=d-a;
    w=f-s;
    e=j-g;
    r=k-h;
        if(q*r==w*e&&q!=0&&w!=0&&e!=0&&r!=0)cout<<"YES"<<endl;
        else if(q==0&&e==0&&w==r)cout<<"YES"<<endl;
        else if(w==0&&r==0&&q==e)cout<<"YES"<<endl;
        else  cout<<"NO"<<endl;
    }
    return 0;
}