Alice has a cute cat. To keep her cat fit, Alice wants to design an exercising walk for her cat! 

Initially, Alice's cat is located in a cell (x,y) of an infinite grid. According to Alice's theory, cat needs to move: 

  * exactly a steps left: from (u,v) to (u-1,v); 
  * exactly b steps right: from (u,v) to (u+1,v); 
  * exactly c steps down: from (u,v) to (u,v-1); 
  * exactly d steps up: from (u,v) to (u,v+1). 



Note that the moves can be performed in an arbitrary order. For example, if the cat has to move 1 step left, 3 steps right and 2 steps down, then the walk right, down, left, right, right, down is valid.

Alice, however, is worrying that her cat might get lost if it moves far away from her. So she hopes that her cat is always in the area [x_1,x_2]× [y_1,y_2], i.e. for every cat's position (u,v) of a walk x_1 ≤ u ≤ x_2 and y_1 ≤ v ≤ y_2 holds.

Also, note that the cat can visit the same cell multiple times.

Can you help Alice find out if there exists a walk satisfying her wishes?

Formally, the walk should contain exactly a+b+c+d unit moves (a to the left, b to the right, c to the down, d to the up). Alice can do the moves in any order. Her current position (u, v) should always satisfy the constraints: x_1 ≤ u ≤ x_2, y_1 ≤ v ≤ y_2. The staring point is (x, y).

You are required to answer t test cases independently.

Input

The first line contains a single integer t (1 ≤ t ≤ 10^3) — the number of testcases. 

The first line of each test case contains four integers a, b, c, d (0 ≤ a,b,c,d ≤ 10^8, a+b+c+d ≥ 1).

The second line of the test case contains six integers x, y, x_1, y_1, x_2, y_2 (-10^8 ≤ x_1≤ x ≤ x_2 ≤ 10^8, -10^8 ≤ y_1 ≤ y ≤ y_2 ≤ 10^8).

Output

For each test case, output "YES" in a separate line, if there exists a walk satisfying her wishes. Otherwise, output "NO" in a separate line. 

You can print each letter in any case (upper or lower).

Example

Input


6
3 2 2 2
0 0 -2 -2 2 2
3 1 4 1
0 0 -1 -1 1 1
1 1 1 1
1 1 1 1 1 1
0 0 0 1
0 0 0 0 0 1
5 1 1 1
0 0 -100 -100 0 100
1 1 5 1
0 0 -100 -100 100 0


Output


Yes
No
No
Yes
Yes
Yes

Note

In the first test case, one valid exercising walk is $$$(0,0)→ (-1,0) → (-2,0)→ (-2,1) → (-2,2)→ (-1,2)→(0,2)→ (0,1)→ (0,0) → (-1,0)$$$
#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;
    }
  }
}
