/** author: shobonvip created: 2026.07.29 19:49:23 **/ #include using namespace std; //* ATCODER #include using namespace atcoder; typedef modint998244353 mint; //*/ /* BOOST MULTIPRECISION #include using namespace boost::multiprecision; //*/ typedef long long ll; #define rep(i, s, n) for (int i = (int)(s); i < (int)(n); i++) #define rrep(i, s, n) for (int i = (int)(n)-1; i >= (int)(s); i--) #define all(v) v.begin(), v.end() template bool chmin(T &a, const T &b) { if (a <= b) return false; a = b; return true; } template bool chmax(T &a, const T &b) { if (a >= b) return false; a = b; return true; } template T max(vector &a){ assert(!a.empty()); T ret = a[0]; for (int i=0; i<(int)a.size(); i++) chmax(ret, a[i]); return ret; } template T min(vector &a){ assert(!a.empty()); T ret = a[0]; for (int i=0; i<(int)a.size(); i++) chmin(ret, a[i]); return ret; } template T sum(vector &a){ T ret = 0; for (int i=0; i<(int)a.size(); i++) ret += a[i]; return ret; } void YES() { cout << "Yes\n"; } void NO() { cout << "No\n"; } ll dist2(ll x1, ll y1, ll x2, ll y2) { return (x1 - y1) * (x1 - y1) + (x2 - y2) * (x2 - y2); } void solve() { ll x1, y1, x2, y2; cin >> x1 >> y1 >> x2 >> y2; ll a1, b1, a2, b2; cin >> a1 >> b1 >> a2 >> b2; if (pair(x1, y1) == pair(a1, b1) && pair(x2, y2) == pair(a2, y2)) { YES(); return; } if (dist2(x1, y1, x2, y2) <= dist2(a1, b1, a2, b2)) { NO(); return; } ll xt = x2 - x1; ll yt = y2 - y1; ll at = a2 - a1; ll bt = b2 - b1; if (xt * at + yt * bt < 0) { NO(); return; } if (xt * bt - yt * at == 0) { YES(); return; } else { NO(); return; } } int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); int t; cin >> t; while (t--) solve(); }