#include #include using namespace std; using ll = long long; #define rep(i,n) for(int i=0;i<(int)(n);i++) using mint = atcoder::modint998244353; void solve(){ vector bfx(2),bfy(2),afx(2),afy(2); cin>>bfx.at(0)>>bfy.at(0)>>bfx.at(1)>>bfy.at(1)>>afx.at(0)>>afy.at(0)>>afx.at(1)>>afy.at(1); if(bfx==afx&&bfy==afy){ cout<<"Yes\n"; return; } ll dx1=bfx.at(0)-bfx.at(1),dx2=afx.at(0)-afx.at(1),dy1=bfy.at(0)-bfy.at(1),dy2=afy.at(0)-afy.at(1); if(dy1*dx2==dy2*dx1&&dx1*dx2>0&&dx1*dx1+dy1*dy1>dx2*dx2+dy2*dy2){ cout<<"Yes\n"; }else{ cout<<"No\n"; } } int main(){ int t; cin>>t; rep(i,t) solve(); }