#include #include #include #include #include #include #include using namespace std; int n, a[3], b[3]; int main() { cin >> n; for (int i = 0; i < n; i++) { cin >> a[0] >> a[1] >> a[2] >> b[0] >> b[1] >> b[2]; if (b[1] == b[2]) swap(a[0], a[2]), swap(b[0], b[2]); if (b[1] == b[2]) { cout << ((a[0] < a[1] && a[1] > a[2] && a[0] != a[2]) || (a[0] > a[1] && a[1] < a[2] && a[0] != a[2]) ? "YES" : "NO") << endl; } else if (b[0] == b[2]) { cout << (a[0] == a[2] ? "NO" : "YES") << endl; } else if (b[0] == b[1]) { if (a[0] == a[1]) cout << "NO" << endl; else if (a[0] < a[1]) cout << (a[1] > a[2] || b[1] > b[2] ? "YES" : "NO") << endl; else cout << (a[1] < a[2] || b[1] < b[2] ? "YES" : "NO") << endl; } else { double p1 = -1.0 * (a[0] - a[1]) / (b[0] - b[1]); double p2 = -1.0 * (a[1] - a[2]) / (b[1] - b[2]); vector r; r.push_back(0); if(p1 > 0) r.push_back(p1); if(p2 > 0) r.push_back(p2); r.push_back(1.0e+9); sort(r.begin(), r.end()); bool flag = false; for (int i = 0; i <= r.size() * 3 - 3; i++) { double t = r[i / 3]; if (i % 3 == 1) t = (r[i / 3] * 2 + r[i / 3 + 1]) / 3; if (i % 3 == 2) t = (r[i / 3] + r[i / 3 + 1] * 2) / 3; double x = a[0] + t * b[0], y = a[1] + t * b[1], z = a[2] + t * b[2]; if ((x < y - 1.0e-7 && y - 1.0e-7 > z && abs(x - z) > 1.0e-7) || (x > y + 1.0e-7 && y + 1.0e-7 < z && abs(x - z) > 1.0e-7)) { flag = true; } } cout << (flag ? "YES" : "NO") << endl; } } return 0; }