#include <bits/stdc++.h>
using namespace std;
const int E4 = 1e4 + 2;
const int E5 = 1e5 + 2;
const int E6 = 1e6 + 2;
const int MOD = 1e9 + 7;
const int INF = 1e9 + 8;
const double eps = 1e-12;
const double pi = 3.14159265359;
const long long INFL = 1ll * INF * INF;
void getTime(double sub = 0.0) {
  cout << "Time : " << fixed << clock() * 1.0 / CLOCKS_PER_SEC - sub << '\n';
}
double getClock() { return clock() * 1.0 / CLOCKS_PER_SEC; }
long long pw(long long a, long long n, long long K = MOD) {
  return (n ? (pw(((a % K) * (a % K)) % K, n / 2ll, K) *
               ((n & 1ll) ? (a % K) : 1ll)) %
                  K
            : 1ll);
}
int gcd(int a, int b) { return (b == 0 ? a : gcd(b, a % b)); }
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
int lcm(int a, int b) { return a * (b / gcd(a, b)); }
long long lcm(long long a, long long b) { return (b / gcd(a, b)) * a; }
int fact(int n) { return n > 0 ? n * fact(n - 1) : 1; }
long long fact(long long n) { return n > 0 ? n * fact(n - 1) : 1; }
int choose(int k, int n) {
  if (k > n) return 0;
  k = (n - k > k ? n - k : k);
  if (k == 0) return 1;
  int R = n;
  for (int i = 2; i <= k; i++) {
    R = R * (n - i + 1) / i;
  }
  return R;
}
long long choose(long long k, long long n) {
  if (k > n) return 0;
  k = (n - k > k ? n - k : k);
  if (k == 0) return 1;
  int R = n;
  for (int i = 2; i <= k; i++) {
    R = R * (n - i + 1) / i;
  }
  return R;
}
int lowbit(int m) { return m & (-m); }
int hibit(int m) {
  for (int i = 30; i >= 0; i--)
    if ((1 << i) & m) return i;
}
long long hibit(long long m) {
  for (int i = 62; i >= 0; i--)
    if ((1ll << i) & m) return i;
}
int getbit(int x, int b) { return (x >> b) & 1; }
long long getbit(long long x, int b) { return (x >> b) & 1; }
int setbit(int x, int b) { return x | (1 << b); }
void _setbit(int &x, int b) { x = setbit(x, b); }
long long setbit(long long x, int b) { return x | (1ll << b); }
void _setbit(long long &x, int b) { x = setbit(x, b); }
int unsetbit(int x, int b) { return x & ((~0) - (1 << b)); }
void _unsetbit(int &x, int b) { x = unsetbit(x, b); }
int bitcnt(int x) {
  x = x - ((x >> 1) & 0x55555555);
  x = (x & 0x33333333) + ((x >> 2) & 0x33333333);
  return ((x + (x >> 4) & 0xF0F0F0F) * 0x1010101) >> 24;
}
long long bitcnt(long long x) {
  int p1 = (x >> 32) & ((1ll << 32) - 1);
  int p2 = x & ((1ll << 32) - 1);
  return bitcnt(p1) + bitcnt(p2);
}
string bin(int x, int len = -1) {
  if (len == -1) {
    len = hibit(x) + 1;
  }
  string res = "";
  for (int i = len - 1; i >= 0; i--) res.push_back(getbit(x, i) + '0');
  return res;
}
string bin(long long x, int len = -1) {
  if (len == -1) {
    len = hibit(x) + 1;
  }
  string res = "";
  for (int i = len - 1; i >= 0; i--) res.push_back(getbit(x, i) + '0');
  return res;
}
int zerocnt(int x) { return hibit(x) - bitcnt(x) + 1; }
int zerocnt(long long x) { return hibit(x) - bitcnt(x) + 1; }
struct IO {
  IO operator>>(int &n) const {
    n = 0;
    bool sign = 0;
    int a = getchar();
    while (a < '0' || a > '9') {
      if (a == '-') {
        sign = 1;
        a = getchar();
        break;
      }
      a = getchar();
    }
    while (a >= '0' && a <= '9') {
      n = (n << 1) + (n << 3) + a - '0';
      a = getchar();
    }
    if (sign) n = ~(n - 1);
    return *this;
  }
  IO operator>>(long long &n) {
    n = 0;
    bool sign = 0;
    char c = getchar();
    while (c < '0' || c > '9') {
      if (c == '-') sign = true;
      c = getchar();
    }
    while (c >= '0' && c <= '9') {
      n = n * 10 + c - 48;
      c = getchar();
    }
    if (sign) n = ~(n - 1);
    return *this;
  }
  IO operator>>(double &x) const {
    scanf("%lf", &x);
    return *this;
  }
  IO operator>>(char &x) const {
    do {
      x = getchar();
    } while (x == ' ' || x == '\n');
    return *this;
  }
  IO operator>>(string &s) const {
    cin >> s;
    return *this;
  }
  IO operator<<(const int x) const {
    printf("%d", x);
    return *this;
  }
  IO operator<<(const double x) const {
    printf("%lf", x);
    return *this;
  }
  IO operator<<(const char x) const {
    putchar(x);
    return *this;
  }
  IO operator<<(const long long x) const {
    cout << x;
    return *this;
  }
  IO operator<<(string x) {
    printf("%s", (x.c_str()));
    return *this;
  }
} in, out;
namespace Input {
template <template <typename, typename...> class Container, typename T>
void cinv(Container<T> &a, int n) {
  for (int i = 0; i < n; i++) {
    T t;
    cin >> t;
    a.push_back(t);
  }
}
template <typename T>
void cinv(T *ptr, int len) {
  for (int i = 0; i < len; i++) {
    in >> *(ptr + i);
  }
}
template <typename T>
void cinv(T A, int n, int m) {
  for (int i = 0; i < n; i++) {
    cinv(A[i], m);
  }
}
}  // namespace Input
namespace Output {
void split(char A) {
  if (A != '0') {
    putchar(A);
  }
}
template <typename T>
void Print(T A, char sp = '0') {
  out << A;
  split(sp);
}
template <typename T1, typename T2>
void Print(pair<T1, T2> A, char sp = '0') {
  cout << '(' << A.first << ',' << A.second << ')';
  split(sp);
}
template <typename T>
void Print(T A[], int len, char sp = ' ') {
  for (int i = 0; i < len; i++) {
    out << A[i];
    split(sp);
  }
}
template <typename T>
void Print(T *A, int n, int m, char nsp = ' ', char sp = '\n') {
  for (int i = 0; i < n; i++) {
    Print(A[i], m, nsp);
    split(sp);
  }
}
template <template <typename, typename...> class Container, typename T>
void Print(Container<T> C, char sp = ' ') {
  for (auto i : C) {
    Print(i);
    split(sp);
  }
}
template <typename T>
void Print(stack<T> A, char sp = ' ') {
  while (A.size()) {
    Print(A.top());
    split(sp);
    A.pop();
  }
}
template <template <typename, typename...> class Container, typename T1,
          typename T2>
void Print(Container<T1, T2> C, char sp = ' ') {
  for (auto i : C) {
    Print(i);
    split(sp);
  }
}
template <typename T>
void Printl(T A) {
  Print(A, '\n');
}
}  // namespace Output
using namespace Output;
using namespace Input;
int t;
bool inRange(int a, int b, int c) { return a >= b && a <= c; }
int main() {
  cin >> t;
  while (t--) {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    int x, y, x1, y1, x2, y2;
    cin >> x >> y >> x1 >> y1 >> x2 >> y2;
    int vecX = b - a;
    int vecY = d - c;
    int finalX = x + vecX;
    int finalY = y + vecY;
    if ((a > 0 || b > 0) && ((x2 - x1) == 0)) {
      cout << "NO" << endl;
      continue;
    }
    if ((c > 0 || d > 0) && (y2 - y1) == 0) {
      cout << "NO" << endl;
      continue;
    }
    if (inRange(finalX, x1, x2) && inRange(finalY, y1, y2)) {
      cout << "YES" << endl;
    } else {
      cout << "NO" << endl;
    }
  }
}
