#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  scanf("%lld", &n);
  for (long long i = 0; i < n; i++) {
    long long a, b, c, d, x, y, x1, y1, x2, y2;
    cin >> a >> b >> c >> d;
    cin >> x >> y >> x1 >> y1 >> x2 >> y2;
    if ((a + b) > 0 || (c + d) > 0) {
      if ((a + b) && x == x1 && x == x2)
        cout << "NO" << endl;
      else if ((c + d) && y == y1 && y == y2)
        cout << "NO" << endl;
      else {
        x += (b - a);
        y += (d - c);
        if (x >= x1 && x <= x2) {
          if (y >= y1 && y <= y2)
            cout << "YES" << endl;
          else
            cout << "NO" << endl;
        } else
          cout << "NO" << endl;
      }
    }
  }
}
