#include #include #include #include #include #include #include using namespace std; int n, a[3], b[3]; int main() { cin >> n; for (int i = 0; i < n; i++) { cin >> a[0] >> a[1] >> a[2] >> b[0] >> b[1] >> b[2]; if (b[0] > b[1] && b[1] < b[2] && (a[0] != a[2] || b[0] != b[2])) cout << "YES" << endl; else if (b[0] < b[1] && b[1] > b[2] && (a[0] != a[2] || b[0] != b[2])) cout << "YES" << endl; else { a[0] *= 1000; a[1] *= 1000; a[2] *= 1000; bool flag = false; for (int j = 0; j <= 1000000; j++) { int x = a[0] + b[0] * j, y = a[1] + b[1] * j, z = a[2] + b[2] * j; if ((x < y && y > z && x != z) || (x > y && y < z && x != z)) { cout << "YES" << endl; flag = true; break; } } if (!flag) cout << "NO" << endl; } } return 0; }