#include #include #include #include #include #include #include using namespace std; bool foo(int x[3], int y[3]) { for (int i = 0; i < 3; i++) for (int j = 0; j < i; j++) if (y[i] == y[j] && x[i] == x[j]) return false; if (y[1] > y[0] && y[1] > y[2]) return true; if (x[1] > x[0] && x[1] > x[2]) return true; for (int i = 0; i < 3; i += 2) if (x[1] <= x[i] && y[1] <= y[i]) return false; if (y[1] <= y[0] && y[1] <= y[2]) return false; if (y[1] > y[2]) { swap(x[0], x[2]); swap(y[0], y[2]); } return (x[0] - x[1]) * (y[1] - y[2]) < (x[2] - x[1]) * (y[1] - y[0]); } bool is_kadomatsu(int x[3], int y[3]) { if (foo(x, y)) return true; for (int j = 0; j < 3; j++) { x[j] *= -1; y[j] *= -1; } if (foo(x, y)) return true; return false; } int main() { int n; cin >> n; for (int i = 0; i < n; i++) { int x[3], y[3]; for (int j = 0; j < 3; j++) { cin >> x[j]; } for (int j = 0; j < 3; j++) { cin >> y[j]; } cout << (is_kadomatsu(x, y) ? "YES" : "NO") << endl; } return 0; }