#include <bits/stdc++.h>
using namespace std;
bool isprime(long long n) {
  for (long long i = 2; i * i <= n; i++) {
    if (n % i == 0) return false;
  }
  return true;
}
bool sortbysec(const pair<long long, long long> &a,
               const pair<long long, long long> &b) {
  return a.second < b.second;
}
void frooty() {
  long long a, b, c, d;
  cin >> a >> b >> c >> d;
  long long x, y, x1, x2, y1, y2;
  cin >> x >> y >> x1 >> y1 >> x2 >> y2;
  if (y1 > y2) {
    swap(y1, y2);
  }
  if (x1 > x2) swap(x1, x2);
  long long ed = abs(c - d);
  long long er = abs(a - b);
  if (c > d) {
    if (ed > y - y1 || (y1 == y2 && (c != 0 || d != 0)))
      cout << "NO" << endl;
    else {
      if (a > b) {
        if (er > x - x1 || (x2 == x1 && (a != 0 || b != 0)))
          cout << "NO" << endl;
        else
          cout << "YES" << endl;
      } else {
        if (er > x2 - x || (x2 == x1 && (a != 0 || b != 0)))
          cout << "NO" << endl;
        else
          cout << "YES" << endl;
      }
    }
  } else {
    if (ed > y2 - y || (y1 == y2 && (c != 0 || d != 0)))
      cout << "NO" << endl;
    else {
      if (a > b) {
        if (er > x - x1 || (x2 == x1 && (a != 0 || b != 0)))
          cout << "NO" << endl;
        else
          cout << "YES" << endl;
      } else {
        if (er > x2 - x || (x2 == x1 && (a != 0 || b != 0)))
          cout << "NO" << endl;
        else
          cout << "YES" << endl;
      }
    }
  }
}
int main() {
  long long t;
  cin >> t;
  while (t--) {
    frooty();
  }
}
