#include using namespace std; using ll = long long; using ld = long double; using ull = unsigned long long; #define rep(i,n) for(ll i=0;i T div_floor(T a, T b) { return a / b - ((a ^ b) < 0 && a % b); } template T div_ceil(T a, T b) { return a / b + ((a ^ b) > 0 && a % b); } template inline bool chmin(T &x, U y) { return (y < x) ? (x = y, true) : false; } template inline bool chmax(T &x, U y) { return (x < y) ? (x = y, true) : false; } template ostream &operator<<(ostream &os, const vector &a){ if (a.empty()) return os; os << a.front(); for (auto e : a | views::drop(1)){ os << ' ' << e; } return os; } void dump(auto ...vs){ ((cout << vs << ' '), ...) << endl; } pair operator+(pair a,pair b){ return {a.first+b.first,a.second+b.second}; } pair operator-(pair a,pair b){ return {a.first-b.first,a.second-b.second}; } ll cross(pair a,pair b){ return a.first*b.second-a.second*b.first; } ll dot(pair a,pair b){ return a.first*b.first+a.second*b.second; } ll len2(pair a){ return a.first*a.first+a.second*a.second; } bool operator==(pair a,pair b){ return (a.first==b.first)&&(a.second==b.second); } void solve() { pair p1,p2,q1,q2; auto input=[](pair &a){ cin>>a.first>>a.second; }; input(p1); input(p2); input(q1); input(q2); if(q1==p1 and q2==p2){ cout<<"Yes"<<'\n'; return; } pair pv=p2-p1; pair qv=q2-q1; if (len2(pv)==0){ if (len2(qv)==0){ cout<<"Yes"<<'\n'; return; } else{ cout<<"No"<<'\n'; return; } } if (len2(qv)==0){ cout<<"No"<<'\n'; return; } if (len2(pv)<=len2(qv)){ cout<<"No"<<'\n'; return; } if (cross(pv,qv)!=0){ cout<<"No"<<'\n'; return; } if (dot(pv,qv)>=0){ cout<<"Yes"<<'\n'; } else{ cout<<"No"<<'\n'; } return; } int main() { ll T=1; cin>>T; while (T--){ solve(); } return 0; }