#define _USE_MATH_DEFINES #include "bits/stdc++.h" using namespace std; #define FOR(i,j,k) for(int (i)=(j);(i)<(int)(k);++(i)) #define rep(i,j) FOR(i,0,j) #define each(x,y) for(auto &(x):(y)) #define mp make_pair #define MT make_tuple #define all(x) (x).begin(),(x).end() #define debug(x) cout<<#x<<": "<<(x)< >(b,vector(c,d)) #define vvv(a,b,c,d,e) vector > >(b,vv(a,c,d,e)) using ll = long long; using pii = pair; using vi = vector; using vll = vector; const int NG = -1, LS = 0, GR = 1, ANY = 2; // a1*x+b1 < a2*x+b2 となるx範囲 pair range(ll a1, ll b1, ll a2, ll b2) { if (a1 == a2) { if (b1 >= b2)RT mp(NG, 0); else RT mp(ANY, 0); } pair res(LS, 0); res.second = (b2 - b1)*1.0 / (a1 - a2); if (a1 < a2) { res.first = GR; } RT res; } void f(pair p, double &l, double &r) { if (p.first == NG)r = -1; if (p.first == LS)smin(r, p.second); if (p.first == GR)smax(l, p.second); } int A[4][3] = { {1,0,2}, {2,0,1}, {0,2,1}, {1,2,0} }; int main() { ios::sync_with_stdio(false); cin.tie(0); cout << fixed << setprecision(20); int N; cin >> N; const double MA = numeric_limits::max(); while (N--) { ll a[3], b[3]; rep(i, 3)cin >> b[i]; rep(i, 3)cin >> a[i]; string ans = "NO"; rep(c, 4) { double l = 0, r = MA; int i = A[c][0], j = A[c][1], k = A[c][2]; auto p = range(a[i], b[i], a[j], b[j]); auto q = range(a[j], b[j], a[k], b[k]); f(p, l, r); f(q, l, r); if (l1e-6) { ans = "YES"; break; } } cout << ans << endl; } }