#include #include #include #include #include #include #include #include #include #include #include const int MOD = 1e9 + 7; const int iINF = 1000000000; const long long int llINF = 1000000000000000000; #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; using ll = long long int; using P = pair; using edge = struct { int to; int cost; }; bool check(double a, double b, double c) { return a != b && b != c && c != a && (a < b && c < b) || (a > b && c > b); } bool solve(double x1, double x2, double x3, double y1, double y2, double y3) { if (check(x1, x2, x3)) return true; if (check(y1, y2, y3)) return true; double tl = 0.0; double th = 1e9; double tc; rep(i, 80) { tc = (tl + th) / 2; if (check(x1 + y1 * tc, x2 + y2 * tc, x3 + y3 * tc)) return true; if (x1 + y1 * (-1e9) < x3 + y3 * (-1e9) == x1 + y1 * tc < x3 + y3 * tc) tl = tc; else th = tc; } return false; } int main() { int n; double x1, x2, x3, y1, y2, y3; cin >> n; for (int i = 0; i < n; i++) { cin >> x1 >> x2 >> x3 >> y1 >> y2 >> y3; if (solve(x1, x2, x3, y1, y2, y3)) cout << "YES" << endl; else cout << "NO" << endl; } return 0; }