#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

const double eps = 1e-8;

bool is_kadomatsu(double x, double y, double z) {
  if (abs(x - y) < eps) return false;
  if (abs(x - z) < eps) return false;
  if (abs(y - z) < eps) return false;
  return (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<double> 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]);
          cand.push_back(c - 1e-6);
          cand.push_back(c + 1e-6);
        }
      }
    }

    bool ok = false;
    for (double c : cand) if (c >= 0) {
      ok |= is_kadomatsu(x[0] + y[0] * c, x[1] + y[1] * c, x[2] + y[2] * c);
    }
    puts(ok ? "YES" : "NO");
  }
}