#include #include #include using namespace std; bool is_kadomatsu(double x, double y, double z) { return x != y && x != z && y != z && (x < y && y > z || x > y && y < z); } int main() { int T; cin >> T; while (T--) { double x[3]; double y[3]; for (int i = 0; i < 3; i++) cin >> x[i]; for (int i = 0; i < 3; i++) cin >> y[i]; vector cand; cand.push_back(0); cand.push_back(12312312); // x[i]+y[i]*k == x[j]+y[j]*k for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { if (y[j] != y[i]) { double c = (x[i] - x[j]) / (y[j] - y[i]); if (c >= 1e-6) { cand.push_back(c - 1e-6); } cand.push_back(c + 1e-6); } } } bool ok = false; for (double c : cand) { ok |= is_kadomatsu(x[0] + y[0] * c, x[1] + y[1] * c, x[2] + y[2] * c); } puts(ok ? "YES" : "NO"); } }