#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    bool flag = false;
    long long a, b, c, d;
    cin >> a >> b >> c >> d;
    long long x, y, x1, y1, x2, y2;
    cin >> x >> y >> x1 >> y1 >> x2 >> y2;
    x = x + (b - a);
    y = y + (d - c);
    if (x1 <= x && x <= x2 && y1 <= y && y <= y2) {
      if (!(a + b) && (c + d)) {
        if (y1 < y2) {
          flag = true;
        }
      } else if (!(c + d) && (a + b)) {
        if (x1 < x2) {
          flag = true;
        }
      } else if ((c + d) && (a + b)) {
        if (x1 < x2 && y1 < y2) {
          flag = true;
        }
      }
    }
    if (flag)
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }
  return 0;
}
