#include using namespace std; using int64 = long long; const int64 INF = 1LL << 62; int main() { int N; cin >> N; while(N--) { double x[3], y[3]; cin >> x[0] >> x[1] >> x[2]; cin >> y[0] >> y[1] >> y[2]; // えー x[1] が一番小さい時間帯はいつごろか // 経過時間を t とします // x[1]+y[1]t <= x[0]+y[0]t // x[1]+y[1]t <= x[2]+y[2]t // を満たしていれば良いです // (x[1]-x[0])/(y[0]-y[1])<=t<=(x[0]-x[1])/(y[1]-y[0]) double low = 0, high = 1e18; if(x[1] < x[0] && y[1] < y[0]) { low = max(low, 0.0); } else if(x[1] < x[0] && y[1] > y[0]) { high = min(high, (x[0] - x[1]) / (y[1] - y[0]) - 1e-9); } else if(x[0] == x[1] && y[1] < y[0]) { low = max(low, 1e-9); } else if(x[1] > x[0] && y[1] < y[0]) { low = max(low, (x[1] - x[0]) / (y[0] - y[1]) + 1e-9); } else { low = 1e18; } swap(x[0], x[2]); swap(y[0], y[2]); if(x[1] < x[0] && y[1] < y[0]) { low = max(low, 0.0); } else if(x[1] < x[0] && y[1] > y[0]) { high = min(high, (x[0] - x[1]) / (y[1] - y[0]) - 1e-9); } else if(x[0] == x[1] && y[1] < y[0]) { low = max(low, 1e-9); } else if(x[1] > x[0] && y[1] < y[0]) { low = max(low, (x[1] - x[0]) / (y[0] - y[1]) + 1e-9); } else { low = 1e19; } if(low <= high) { if(y[0] != y[2] || x[0] != x[2]) { puts("YES"); continue; } } low = 0, high = 1e18; swap(x[0], x[1]); swap(y[0], y[1]); if(x[1] < x[0] && y[1] < y[0]) { low = max(low, 0.0); } else if(x[1] < x[0] && y[1] > y[0]) { high = min(high, (x[0] - x[1]) / (y[1] - y[0]) - 1e-9); } else if(x[0] == x[1] && y[1] < y[0]) { low = max(low, 1e-9); } else if(x[1] > x[0] && y[1] < y[0]) { low = max(low, (x[1] - x[0]) / (y[0] - y[1]) + 1e-9); } else { low = 1e19; } swap(x[0], x[1]); swap(y[0], y[1]); swap(x[0], x[2]); swap(y[0], y[2]); swap(x[0], x[1]); swap(y[0], y[1]); if(x[1] < x[0] && y[1] < y[0]) { low = max(low, 0.0); } else if(x[1] < x[0] && y[1] > y[0]) { high = min(high, (x[0] - x[1]) / (y[1] - y[0]) - 1e-9); } else if(x[0] == x[1] && y[1] < y[0]) { low = max(low, 1e-9); } else if(x[1] > x[0] && y[1] < y[0]) { low = max(low, (x[1] - x[0]) / (y[0] - y[1]) + 1e-9); } else { low = 1e19; } swap(x[0], x[1]); swap(y[0], y[1]); if(low <= high) { if(y[0] != y[2] || x[0] != x[2]) { puts("YES"); continue; } } puts("NO"); } }