#include <bits/stdc++.h>
using namespace std;
inline void chkmax(int &a, int b) {
  if (a < b) a = b;
}
inline void chkmin(int &a, int b) {
  if (a > b) a = b;
}
inline int read() {
  int a = 0, fh = 1;
  char c = getchar();
  while (c > '9' || c < '0') {
    if (c == '-') fh = -1;
    c = getchar();
  }
  while ('0' <= c && c <= '9') {
    a = a * 10 + c - 48;
    c = getchar();
  }
  return a * fh;
}
int T, n, m;
char ch[200005];
int a[200005];
int main() {
  T = read();
  while (T--) {
    int a = read(), b = read(), c = read(), d = read();
    int x = read(), y = read(), x1 = read(), y1 = read(), x2 = read(),
        y2 = read();
    int X = b - a, Y = d - c, flag = 0;
    if ((a || b) && x1 == x2) flag = 1;
    if ((c || d) && y1 == y2) flag = 1;
    if (x + X > x2 || x + X < x1 || y + Y > y2 || y + Y < y1) flag = 1;
    puts((!flag) ? "YES" : "NO");
  }
  return 0;
}
