#include #include #include #include #include #include #include using namespace std; #define YES \ cout << "YES" << endl; \ continue; #define NO \ cout << "NO" << endl; \ continue; int N; int main() { cin >> N; for (int i = 0;i < N; i++) { int x1, x2, x3, y1, y2, y3; cin >> x1 >> x2 >> x3 >> y1 >> y2 >> y3; if (x1 < x2 && x2 > x3) { YES } if (x1 > x2 && x2 < x3) { YES } if (y1 < y2 && y2 > y3) { YES } if (y1 > y2 && y2 < y3) { YES } if (x1 > x3) { swap(y1, y3); swap(x1, x3); } if (y1 <= y2 && y2 <= y3) { NO } double timec = (1.0) * (x3 - x2) / (y2 - y3); if (x1 + y1 * timec < x2 + y2 * timec) { YES } timec = (1.0) * (x3 - x1) / (y1 - y3); if (x1 + y1 * timec > x2 + y2 * timec) { YES } timec = (1.0) * (x3 - x1) / (y1 - y3); if (x1 + y1 * timec < x2 + y2 * timec) { YES } timec = (1.0) * (x3 - x2) / (y2 - y3); if (x2 + y2 * timec < x3 + y3 * timec) { YES } NO } }