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]\times [y_1,y_2]$, i.e. for every cat's position $(u,v)$ of a walk $x_1 \le u \le x_2$ and $y_1 \le v \le 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 \le u \le x_2$, $y_1 \le v \le 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 \le t \le 10^3$) — the number of testcases. 

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

The second line of the test case contains six integers $x$, $y$, $x_1$, $y_1$, $x_2$, $y_2$ ($-10^8 \le x_1\le x \le x_2 \le 10^8$, $-10^8 \le y_1 \le y \le y_2 \le 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)\rightarrow (-1,0) \rightarrow (-2,0)\rightarrow (-2,1) \rightarrow (-2,2)\rightarrow (-1,2)\rightarrow(0,2)\rightarrow (0,1)\rightarrow (0,0) \rightarrow (-1,0)$$

Source: codeforces | Difficulty: EASY
Tags: Mathematics

Implementation

Greedy algorithms


Solutions:
for t in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	if ((a == 0 or (a > 0 and x - x1 > 0)) or (b == 0 or (b > 0 and x2 - x > 0))) and ((c == 0 or (c > 0 and y - y1 > 0)) or (d == 0 or (d > 0 and y2 - y > 0))) and (x1 <= x - (a - b) <= x2) and (y1 <= y + (d - c) <= y2):
		print('YES')
	else:
		print('NO')


def check():
	(a, b, c, d) = list(map(int, input().split()))
	(x, y, x1, y1, x2, y2) = list(map(int, input().split()))
	if x - x1 == 0 and x2 - x == 0 and (b != 0 or a != 0):
		print('No')
		return
	if y - y1 == 0 and y2 - y == 0 and (c != 0 or d != 0):
		print('No')
		return
	if x + b - a <= x2 and x - a + b >= x1 and (y + d - c <= y2) and (y + d - c >= y1):
		print('Yes')
	else:
		print('No')
i = int(input())
for j in range(i):
	check()


t = eval(input())
while t is not 0:
	s = list(map(int, input().split()))
	n = list(map(int, input().split()))
	r = n[0] - s[0] + s[1]
	u = n[1] - s[2] + s[3]
	if (r >= n[2] and r <= n[4]) and (u >= n[3] and u <= n[5]):
		if n[2] == n[4] and (s[0] != 0 or s[1] != 0) or (n[3] == n[5] and (s[2] != 0 or s[3] != 0)):
			print('no')
		else:
			print('yes')
	else:
		print('no')
	t = t - 1


t = int(input())
for _ in range(t):
	(a, b, c, d) = [int(x) for x in input().split(' ')]
	(x, y, x1, y1, x2, y2) = [int(x) for x in input().split(' ')]
	x += b - a
	y += d - c
	if a + b > 0 and x1 == x2:
		print('No')
	elif c + d > 0 and y1 == y2:
		print('No')
	elif x1 <= x <= x2 and y1 <= y <= y2:
		print('Yes')
	else:
		print('No')


for i in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	if x1 == x2 and (a != 0 or b != 0):
		print('No')
	elif y1 == y2 and (c != 0 or d != 0):
		print('No')
	elif x1 <= x + b - a <= x2 and y1 <= y + d - c <= y2:
		print('Yes')
	else:
		print('No')


t = int(input())
while t:
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	p1 = b - a
	p2 = a - b
	p3 = c - d
	p4 = d - c
	if x2 >= x + p1 and x1 <= x - p2:
		if b != 0 or a != 0:
			if x1 == x and x2 == x:
				print('NO')
				t -= 1
				continue
		if y2 >= y + p4 and y - p3 >= y1:
			if c != 0 or d != 0:
				if y1 == y and y2 == y:
					print('NO')
					t -= 1
					continue
			print('YES')
		else:
			print('NO')
	else:
		print('NO')
	t -= 1


def li():
	return list(map(int, input().split()))

def ls():
	return list(map(int, list(input())))

def i():
	return int(input())
t = i()
for _ in range(t):
	(a, b, c, d) = li()
	(x, y, x1, y1, x2, y2) = li()
	f_x = -a + b + x
	f_y = -c + d + y
	flag = 1
	if a > 0 or b > 0:
		if x2 - x1 <= 0:
			flag = 0
	if c > 0 or d > 0:
		if y2 - y1 <= 0:
			flag = 0
	if flag == 1:
		if (f_x >= x1 and f_x <= x2) and (f_y >= y1 and f_y <= y2):
			print('Yes')
		else:
			print('No')
	else:
		print('No')


x = int(input())
for i in range(x):
	temp1 = list(map(int, input().split()))
	temp2 = list(map(int, input().split()))
	a = temp1[1] - temp1[0]
	b = temp1[3] - temp1[2]
	if not (temp2[3] <= temp2[1] <= temp2[5] and temp2[2] <= temp2[0] <= temp2[4]):
		print('NO')
		continue
	temp2[0] += a
	temp2[1] += b
	if temp2[2] == temp2[4] and (temp1[1] > 0 or temp1[0] > 0):
		print('NO')
		continue
	elif temp2[3] == temp2[5] and (temp1[2] > 0 or temp1[3] > 0):
		print('NO')
		continue
	elif temp2[2] <= temp2[0] <= temp2[4] and temp2[3] <= temp2[1] <= temp2[5]:
		print('YES')
	else:
		print('NO')


def answer(l, r, d, u, currentPosition, safeArea):
	finalX = currentPosition[0] + (r - l)
	finalY = currentPosition[1] + (u - d)
	xMin = safeArea[0][0]
	xMax = safeArea[1][0]
	yMin = safeArea[0][1]
	yMax = safeArea[1][1]
	if xMin == xMax and (l != 0 or r != 0):
		return 'NO'
	if yMin == yMax and (d != 0 or u != 0):
		return 'NO'
	if (xMin <= finalX and finalX <= xMax) and (yMin <= finalY and finalY <= yMax):
		return 'YES'
	return 'NO'
testCount = int(input())
for _ in range(testCount):
	(l, r, d, u) = map(int, input().split())
	arr = list(map(int, input().split()))
	currentPosition = [arr[0], arr[1]]
	safeArea = [[arr[2], arr[3]], [arr[4], arr[5]]]
	print(answer(l, r, d, u, currentPosition, safeArea))


import math
t = int(input())
for i in range(t):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	if a + b > 0 and x1 == x2:
		print('NO')
		continue
	if c + d > 0 and y1 == y2:
		print('NO')
		continue
	elif x1 <= x - a + b <= x2 and y1 <= y - c + d <= y2:
		print('YES')
	else:
		print('NO')


def main():
	for _ in range(int(input())):
		(a, b, c, d) = list(map(int, input().split()))
		(x, y, x1, y1, x2, y2) = list(map(int, input().split()))
		k = b - a + x
		l = d - c + y
		f1 = f2 = False
		if k == x and (a == b == 0 or x1 != x2):
			f1 = True
		elif k != x and x1 <= k <= x2:
			f1 = True
		if l == y and (c == d == 0 or y1 != y2):
			f2 = True
		elif l != y and y1 <= l <= y2:
			f2 = True
		if f1 and f2:
			print('Yes')
		else:
			print('No')
main()


def check(a, b, x, x1, x2):
	if x1 == x2 and (a != 0 or b != 0):
		return False
	if x1 <= x - a + b <= x2:
		return True
	return False
t = int(input())
for i in range(t):
	(a, b, c, d) = map(int, input().split(' '))
	(x, y, x1, y1, x2, y2) = map(int, input().split(' '))
	if x1 <= x <= x2 and y1 <= y <= y2 and check(a, b, x, x1, x2) and check(c, d, y, y1, y2):
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	(l, r, d, u) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	vx = x + (r - l)
	vy = y + (u - d)
	if x1 == x2 and r != 0 and (l != 0) or (y1 == y2 and u != 0 and (d != 0)):
		print('No')
	elif x1 <= vx <= x2 and y1 <= vy <= y2:
		print('Yes')
	else:
		print('No')


t = int(input())
for t_ in range(t):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	failed = 0
	if x == x1 and b == 0 and (a != 0):
		failed = 1
	if x == x2 and a == 0 and (b != 0):
		failed = 1
	if x1 == x2 and (a != 0 or b != 0):
		failed = 1
	if y == y1 and d == 0 and (c != 0):
		failed = 1
	if y == y2 and c == 0 and (d != 0):
		failed = 1
	if y1 == y2 and (c != 0 or d != 0):
		failed = 1
	if failed == 0 and x1 <= x - a + b <= x2 and (y1 <= y - c + d <= y2):
		print('Yes')
	else:
		print('No')


t = int(input())
while t:
	t -= 1
	(a, b, c, d) = [int(x) for x in input().split()]
	(x, y, x1, y1, x2, y2) = [int(x) for x in input().split()]
	resultx = x + (b - a)
	resulty = y + (d - c)
	if a + b > 0 and x1 == x2:
		print('No')
	elif c + d > 0 and y1 == y2:
		print('No')
	elif resultx <= x2 and resultx >= x1 and (y1 <= resulty <= y2):
		print('Yes')
	else:
		print('No')


t = int(input())
while t != 0:
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	r = x
	p = y
	x += b - a
	y += d - c
	tmp = 0
	if r < x1 or r > x2 or p < y1 or (p > y2):
		tmp = 1
	elif x >= x1 and x <= x2 and (y >= y1) and (y <= y2):
		if x1 == x2:
			if a != 0 or b != 0:
				tmp = 1
		if y1 == y2:
			if c != 0 or d != 0:
				tmp = 1
	else:
		tmp = 1
	if tmp == 1:
		print('No')
	else:
		print('Yes')
	t -= 1


t = int(input())
for _ in range(t):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	(nx, ny) = (x - a + b, y - c + d)
	result = 'No'
	if x1 <= nx <= x2 and y1 <= ny <= y2:
		result = 'Yes'
	if x1 == x2:
		if a != 0 or b != 0:
			result = 'No'
	if y1 == y2:
		if c != 0 or d != 0:
			result = 'No'
	print(result)


def mozhnoli(a, b, c, d, x, y, x1, y1, x2, y2):
	if x1 <= x + b - a <= x2 and y1 <= y + d - c <= y2 and (x1 != x2) and (y1 != y2):
		answer = 'YES'
	elif x1 == x2 and y1 != y2 and (y1 <= y + d - c <= y2) and (a == b == 0) or (y1 == y2 and x1 != x2 and (x1 <= x + b - a <= x2) and (c == d == 0)):
		answer = 'YES'
	else:
		answer = 'NO'
	return answer
t = int(input())
for i in range(t):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	print(mozhnoli(a, b, c, d, x, y, x1, y1, x2, y2))


def main_function():
	t = int(input())
	for i in range(t):
		A = list(map(int, input().split(' ')))
		B = list(map(int, input().split(' ')))
		flagX = not (A[0] or A[1])
		flagY = not (A[2] or A[3])
		if not flagX:
			flagX = B[2] <= A[1] - A[0] + B[0] <= B[4] and B[4] - B[2] != 0
		if not flagY:
			flagY = B[3] <= A[3] - A[2] + B[1] <= B[5] and B[5] - B[3] != 0
		if flagX and flagY:
			print('Yes')
		else:
			print('No')
main_function()


t = int(input())
while t:
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	if x1 == x2 and a + b > 0:
		print('NO')
	elif y1 == y2 and c + d > 0:
		print('NO')
	elif x1 <= x + b - a <= x2 and y1 <= y + d - c <= y2:
		print('YES')
	else:
		print('NO')
	t -= 1


ans = []
for _ in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	if x1 == x2 and a != 0 and (b != 0):
		ans.append('NO')
		continue
	if y1 == y2 and c != 0 and (d != 0):
		ans.append('NO')
		continue
	x += b - a
	y += d - c
	if x1 <= x <= x2 and y1 <= y <= y2:
		ans.append('YES')
	else:
		ans.append('NO')
print('\n'.join(ans))


t = int(input())
sol = []
while t:
	t -= 1
	(a, b, c, d) = tuple(map(int, input().split()))
	(x, y, x1, y1, x2, y2) = tuple(map(int, input().split()))
	if x1 == x2 and (a or b):
		sol.append('NO')
	elif y1 == y2 and (c or d):
		sol.append('NO')
	else:
		min1 = min(a, b)
		a -= min1
		b -= min1
		min2 = min(c, d)
		c -= min2
		d -= min2
		if a:
			x = x - x1
		else:
			x = x2 - x
		if c:
			y = y - y1
		else:
			y = y2 - y
		a = max(a, b)
		c = max(c, d)
		if a > x:
			sol.append('NO')
		elif c > y:
			sol.append('NO')
		else:
			sol.append('YES')
for i in sol:
	print(i)


n = int(input())
(a, b, c, d, x, y, x1, y1, x2, y2) = ([0] * n, [0] * n, [0] * n, [0] * n, [0] * n, [0] * n, [0] * n, [0] * n, [0] * n, [0] * n)
for i in range(n):
	(a[i], b[i], c[i], d[i]) = map(int, input().split())
	(x[i], y[i], x1[i], y1[i], x2[i], y2[i]) = map(int, input().split())
for i in range(n):
	marker = True
	temp = b[i] - a[i]
	if a[i] == b[i] and a[i] != 0:
		if x1[i] == x2[i]:
			marker = False
	if temp >= 0:
		if x[i] + temp > x2[i]:
			marker = False
	elif x[i] + temp < x1[i]:
		marker = False
	if c[i] == d[i] and c[i] != 0:
		if y1[i] == y2[i]:
			marker = False
	temp = d[i] - c[i]
	if temp >= 0:
		if y[i] + temp > y2[i]:
			marker = False
	elif y[i] + temp < y1[i]:
		marker = False
	if marker:
		print('Yes')
	else:
		print('No')


t = int(input())
lst = list()
for l in range(t):
	(l, r, d, u) = input().split()
	(a, b, lr, dr, rr, ur) = input().split()
	if int(r) - int(l) + int(a) <= int(rr) and int(r) - int(l) + int(a) >= int(lr) and (int(u) - int(d) + int(b) <= int(ur)) and (int(u) - int(d) + int(b) >= int(dr)) and (lr != rr or int(l) + int(r) == 0) and (ur != dr or int(u) + int(d) == 0):
		lst.append('Yes')
	else:
		lst.append('No')
for i in lst:
	print(i)


import math
for _ in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	x += b - a
	y += d - c
	f = 0
	if a + b > 0 and x1 == x2:
		print('NO')
	elif c + d > 0 and y1 == y2:
		print('NO')
	elif x1 <= x <= x2 and y1 <= y <= y2:
		print('YES')
	else:
		print('NO')


t = int(input().rstrip())
for _ in range(t):
	(a, b, c, d) = map(int, input().rstrip().split())
	(x, y, x1, y1, x2, y2) = map(int, input().rstrip().split())
	result = False
	x += b - a
	y += d - c
	if a + b > 0 and x1 == x2:
		result = False
	elif c + d > 0 and y1 == y2:
		result = False
	elif x1 <= x <= x2 and y1 <= y <= y2:
		result = True
	else:
		result = False
	if result:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(l, r, d, u) = list(map(int, input().split()))
	(x, y, x1, y1, x2, y2) = list(map(int, input().split()))
	x_axis = r - l
	y_axis = u - d
	if x2 - x >= x_axis and x1 - x <= x_axis and (y2 - y >= y_axis) and (y1 - y <= y_axis):
		if x2 - x1 == 0 and l != 0 or (y2 - y1 == 0 and u != 0):
			print('No')
		else:
			print('Yes')
	else:
		print('No')


t = int(input())
for _ in range(t):
	f = True
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	if a < b and x + b - a > x2 or ((a > 0 or b > 0) and x1 == x2) or (b < a and x - (a - b) < x1):
		f = False
	if c < d and y + d - c > y2 or ((c > 0 or d > 0) and y1 == y2) or (d < c and y - (c - d) < y1):
		f = False
	if f:
		print('Yes')
	else:
		print('No')


n = int(input())
for _ in range(n):
	(l, r, d, u) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	x = x - l + r
	y = y - d + u
	if x1 <= x and x <= x2 and (y1 <= y) and (y <= y2):
		if ((l or r) and x2 - x1 or (not l and (not r))) and ((d or u) and y2 - y1 or (not d and (not u))):
			print('Yes')
			continue
	print('No')


t = int(input())
for _ in range(t):
	(a, b, c, d) = input().split(' ')
	(x, y, x1, y1, x2, y2) = input().split(' ')
	a = int(a)
	b = int(b)
	c = int(c)
	d = int(d)
	x = int(x)
	y = int(y)
	x1 = int(x1)
	y1 = int(y1)
	x2 = int(x2)
	y2 = int(y2)
	posx = x - (a - b)
	posy = y - (c - d)
	ram = 0
	if x1 == x and x == x2:
		if a or b:
			ram = 1
			print('No')
	if y1 == y and y == y2 and (ram == 0):
		if c or d:
			ram = 1
			print('No')
	if x1 <= posx <= x2 and y1 <= posy <= y2 and (ram == 0):
		print('Yes')
	elif ram == 0:
		print('No')


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, copy, functools
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
mod2 = 998244353
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return list(map(int, sys.stdin.readline().split()))

def LLI():
	return [list(map(int, l.split())) for l in sys.stdin.readlines()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def pe(s):
	return print(str(s), file=sys.stderr)

def JA(a, sep):
	return sep.join(map(str, a))

def JAA(a, s, t):
	return s.join((t.join(map(str, b)) for b in a))

def IF(c, t, f):
	return t if c else f

def main():
	t = I()
	rr = []
	for _ in range(t):
		(a, b, c, d) = LI()
		(x, y, x1, y1, x2, y2) = LI()
		ok = True
		if x1 == x2 and (a > 0 or b > 0) or (y1 == y2 and (c > 0 or d > 0)):
			ok = False
		if a > b:
			if x - x1 < a - b:
				ok = False
		elif x2 - x < b - a:
			ok = False
		if c > d:
			if y - y1 < c - d:
				ok = False
		elif y2 - y < d - c:
			ok = False
		rr.append(IF(ok, 'Yes', 'No'))
	return JA(rr, '\n')
print(main())


from collections import defaultdict, deque
from heapq import heappush, heappop
from math import inf
ri = lambda : map(int, input().split())

def solve():
	(left, right, down, up) = ri()
	(start, end, x1, y1, x2, y2) = ri()
	valid = True
	if left == right and left > 0:
		if not (x1 <= start + 1 <= x2 or x1 <= start - 1 <= x2):
			valid = False
	elif left > right:
		diff = left - right
		if not x1 <= start - diff <= x2:
			valid = False
	else:
		diff = right - left
		if not x1 <= start + diff <= x2:
			valid = False
	if up == down and up > 0:
		if not (y1 <= end + 1 <= y2 or y1 <= end - 1 <= y2):
			valid = False
	elif up > down:
		diff = up - down
		if not y1 <= end + diff <= y2:
			valid = False
	else:
		diff = down - up
		if not y1 <= end - diff <= y2:
			valid = False
	if valid:
		print('Yes')
	else:
		print('No')
t = 1
t = int(input())
while t:
	t -= 1
	solve()


from sys import stdin
inp = stdin.readline
t = int(inp().strip())
for i in range(t):
	(a, b, c, d) = [int(x) for x in inp().strip().split()]
	(x, y, x1, y1, x2, y2) = [int(x) for x in inp().strip().split()]
	if (b > 0 or a > 0) and x1 - x2 == 0:
		print('NO')
	elif (c > 0 or d > 0) and y1 - y2 == 0:
		print('NO')
	elif x1 <= x + (b - a) <= x2 and y1 <= y + (d - c) <= y2:
		print('YES')
	else:
		print('NO')


n = int(input())
for i in range(n):
	r = [int(x) for x in input().split()]
	s = [int(x) for x in input().split()]
	pos = True
	if r[0] + r[1] != 0:
		if s[2] != s[4] and r[1] - r[0] + s[0] >= s[2] and (r[1] - r[0] + s[0] <= s[4]):
			pass
		else:
			pos = False
	if r[2] + r[3] != 0:
		if s[3] != s[5] and r[3] - r[2] + s[1] >= s[3] and (r[3] - r[2] + s[1] <= s[5]):
			pass
		else:
			pos = False
	if pos == True:
		print('Yes')
	else:
		print('No')


from __future__ import division, print_function
import os
import sys
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip
from math import sqrt, floor, factorial, gcd
from collections import deque, Counter, defaultdict
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
from collections import deque
input = lambda : sys.stdin.readline().rstrip('\r\n')
read = lambda : list(map(int, input().split(' ')))

def func(arr):
	return sum([arr[i] for i in range(0, len(arr), 2)])

def solve():
	for _ in range(int(input())):
		(a, b, c, d) = read()
		(x, y, x1, y1, x2, y2) = read()
		hor = b - a
		ver = d - c
		if a | b > 0 and x1 == x2:
			print('No')
		elif c | d > 0 and y1 == y2:
			print('No')
		elif x1 <= x + hor <= x2 and y1 <= y + ver <= y2:
			print('Yes')
		else:
			print('No')
solve()


tc = int(input())
for _ in range(tc):
	(a, b, c, d) = map(int, input().split(' '))
	(x, y, x1, y1, x2, y2) = map(int, input().split(' '))
	xn = x - a + b
	yn = y - c + d
	if xn < x1 or xn > x2 or yn < y1 or (yn > y2):
		print('NO')
	elif x2 == x1 and a + b > 0:
		print('NO')
	elif y1 == y2 and c + d > 0:
		print('NO')
	else:
		print('YES')


t = int(input())
while t > 0:
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	flag = True
	if x - a + b <= x2 and x - a + b >= x1 and (y - c + d <= y2) and (y - c + d >= y1) and (x2 > x1 or a + b == 0) and (y2 > y1 or c + d == 0):
		flag = True
	else:
		flag = False
	if flag:
		print('Yes')
	else:
		print('No')
	t -= 1


for _ in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	inx = b - a
	iny = d - c
	u = x + inx
	v = y + iny
	ans = 0
	if abs(x2 - x1) == 0 and (a != 0 or b != 0):
		print('NO')
	elif abs(y2 - y1) == 0 and (c != 0 or d != 0):
		print('NO')
	elif x1 <= u and u <= x2 and (y1 <= v) and (v <= y2):
		print('YES')
	else:
		print('NO')


def main():
	for _ in range(int(input())):
		(a, b, c, d) = map(int, input().split())
		(x, y, x1, y1, x2, y2) = map(int, input().split())
		bol = True
		if a > b + (x - x1) or b > a + (x2 - x):
			bol = False
		if c > y - y1 + d or d > y2 - y + c:
			bol = False
		if c + d > 0 and y1 == y2:
			bol = False
		if a + b > 0 and x1 == x2:
			bol = False
		if bol:
			print('Yes')
		else:
			print('No')
main()


t = int(input())
for rte in range(t):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	xk = x + b - a
	yk = y + d - c
	if xk == x:
		if x == x1 and b > 0:
			xk += 1
		elif a > 0:
			x -= 1
	if yk == y:
		if y == y1 and d > 0:
			yk += 1
		elif c > 0:
			y -= 1
	if x1 <= x <= x2 and y1 <= y <= y2:
		if x1 <= xk <= x2 and y1 <= yk <= y2:
			print('Yes')
		else:
			print('No')
	else:
		print('No')


for i in range(int(input())):
	(a, b, c, d) = [int(i) for i in input().split()]
	(x, y, x1, y1, x2, y2) = [int(i) for i in input().split()]
	xld = -(x - x1)
	xrd = x2 - x
	xo = b - a
	ydd = -(y - y1)
	yud = y2 - y
	yo = d - c
	if (xo >= xld and xo <= xrd and (xld or xrd) or (not xrd and (not xld) and (not a) and (not b))) and (yo >= ydd and yo <= yud and (ydd or yud) or (not ydd and (not yud) and (not c) and (not d))):
		print('Yes')
	else:
		print('No')


t = int(input())
for _ in range(t):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	xmax = max(a, b) - min(a, b)
	ymax = max(c, d) - min(c, d)
	if a > 0 or b > 0:
		if xmax < 1:
			xmax = 1
	if c > 0 or d > 0:
		if ymax < 1:
			ymax = 1
	flag1 = 0
	flag2 = 0
	if a > b:
		if x - xmax < x1:
			flag1 = 1
	elif b > a:
		if x + xmax > x2:
			flag1 = 1
	elif xmax == 1:
		if x - xmax < x1 and x + xmax > x2:
			flag1 = 1
	if c > d:
		if y - ymax < y1:
			flag2 = 1
	elif d > c:
		if y + ymax > y2:
			flag2 = 1
	elif ymax == 1:
		if y - ymax < y1 and y + ymax > y2:
			flag2 = 1
	if flag1 == 1 or flag2 == 1:
		print('No')
	else:
		print('Yes')


def in_range(x, y, x1, x2, y1, y2):
	if x >= x1 and x <= x2 and (y >= y1) and (y <= y2):
		return True
	return False
for _ in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	(n, m) = (x + b - a, y + d - c)
	if x1 == x2 and (a != 0 or b != 0):
		print('NO')
	elif y1 == y2 and (c != 0 or d != 0):
		print('NO')
	elif in_range(x, y, x1, x2, y1, y2) and in_range(n, m, x1, x2, y1, y2):
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	xy = list(map(int, input().split()))
	if xy[2] == xy[4]:
		if b > 0 or a > 0:
			print('No')
			continue
	if xy[5] == xy[3]:
		if d > 0 or c > 0:
			print('No')
			continue
	if b - a > xy[4] - xy[0] or a - b > xy[0] - xy[2] or d - c > xy[5] - xy[1] or (c - d > xy[1] - xy[3]):
		print('No')
	else:
		print('Yes')


import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	if (a > 0 or b > 0) and x2 - x1 == 0:
		print('No')
		continue
	if (c > 0 or d > 0) and y2 - y1 == 0:
		print('No')
		continue
	ok = True
	if a >= b:
		left = a - b
		if left > x - x1:
			ok = False
	else:
		right = b - a
		if right > x2 - x:
			ok = False
	if c >= d:
		down = c - d
		if down > y - y1:
			ok = False
	else:
		up = d - c
		if up > y2 - y:
			ok = False
	if ok:
		print('Yes')
	else:
		print('No')


t = int(input())
for i in range(t):
	abcd = input().split(' ')
	left = int(abcd[0])
	right = int(abcd[1])
	down = int(abcd[2])
	up = int(abcd[3])
	bounds = input().split(' ')
	x = int(bounds[0])
	y = int(bounds[1])
	x1 = int(bounds[2])
	y1 = int(bounds[3])
	x2 = int(bounds[4])
	y2 = int(bounds[5])
	bad = False
	if y < y1 or y > y2 or x < x1 or (x > x2):
		bad = True
	if not bad and (left > 0 or right > 0) and (x1 == x2):
		bad = True
	if not bad and (up > 0 or down > 0) and (y1 == y2):
		bad = True
	xDif = right - left
	yDif = up - down
	if not bad and (xDif + x > x2 or xDif + x < x1):
		bad = True
	if not bad and (yDif + y > y2 or yDif + y < y1):
		bad = True
	if bad:
		print('NO')
	else:
		print('YES')


def NO():
	return print('NO')

def YES():
	return print('YES')

def INT():
	return int(input())

def LIST():
	return list(map(int, input().split()))

def STR():
	return input()

def MAP():
	return map(int, input().split())
for _ in range(INT()):
	(a, b, c, d) = MAP()
	(x, y, x1, y1, x2, y2) = MAP()
	gor = b - a + x
	ver = d - c + y
	check = False
	if a > 0 or b > 0 or c > 0 or (d > 0):
		check = True
	gorcheck = False
	if a > 0 or b > 0:
		gorcheck = True
	vercheck = False
	if c > 0 or d > 0:
		vercheck = True
	if x == x1 and y == y1 and (x == x2) and (y == y2) and check or (gorcheck and x == x1 and (x == x2)) or (vercheck and y == y1 and (y == y2)):
		NO()
	elif gor <= x2 and gor >= x1 and (ver >= y1) and (ver <= y2):
		YES()
	else:
		NO()


import sys
import math
import heapq
import collections

def inputnum():
	return int(input())

def inputnums():
	return map(int, input().split())

def inputlist():
	return list(map(int, input().split()))

def inputstring():
	return [x for x in input()]

def inputmatrixchar(rows):
	arr2d = [[j for j in input().strip()] for i in range(rows)]
	return arr2d

def inputmatrixint(rows):
	arr2d = []
	for _ in range(rows):
		arr2d.append([int(i) for i in input().split()])
	return arr2d
t = int(input())
for q in range(t):
	(a, b, c, d) = inputnums()
	(x, y, x1, y1, x2, y2) = inputnums()
	x += b - a
	y += d - c
	if a + b > 0 and x2 == x1:
		print('No')
	elif c + d > 0 and y2 == y1:
		print('No')
	elif x1 <= x <= x2 and y1 <= y <= y2:
		print('Yes')
	else:
		print('No')


def check(a, b, c, d, x, y, x1, y1, x2, y2):
	if not x1 <= x <= x2 or not y1 <= y <= y2:
		return False
	if x2 == x1 and a > 0 and (b > 0):
		return False
	if y2 == y1 and c > 0 and (d > 0):
		return False
	if a > b:
		if x - x1 < a - b:
			return False
	elif b > a:
		if x2 - x < b - a:
			return False
	if c > d:
		if y - y1 < c - d:
			return False
	elif d > c:
		if y2 - y < d - c:
			return False
	return True
t = int(input())
for _ in range(t):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	if x1 > x2:
		(x1, x2) = (x2, x1)
	if y1 > y2:
		(y1, y2) = (y2, y1)
	if check(a, b, c, d, x, y, x1, y1, x2, y2):
		print('Yes')
	else:
		print('No')


t = int(input())
while t:
	(l, r, d, u) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	l1 = l
	d1 = d
	l = r - l
	d = u - d
	a = x - x1
	b = y - y1
	c = x2 - x
	e = y2 - y
	key = 0
	if x2 - x1 == 0 and (l1 > 0 or r > 0) or (y2 - y1 == 0 and (d1 > 0 or u > 0)):
		print('NO')
		key = 1
	else:
		if l <= 0:
			if d <= 0:
				if abs(l) <= a and abs(d) <= b:
					print('YES')
					key = 1
			elif abs(l) <= a and e >= d:
				print('YES')
				key = 1
		elif d <= 0:
			if l <= c and abs(d) <= b:
				print('YES')
				key = 1
		elif l <= c and e >= d:
			print('YES')
			key = 1
		if key == 0:
			print('NO')
	t -= 1


def pin(x, y, x1, y1, x2, y2):
	return x >= x1 and x <= x2 and (y >= y1) and (y <= y2)
t = int(input())
for i in range(t):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	right = b - a
	up = d - c
	ans = ['No', 'Yes']
	base = pin(x, y, x1, y1, x2, y2) and pin(x + right, y + up, x1, y1, x2, y2)
	condition1 = True
	condition2 = True
	if b == a and a != 0:
		condition1 = pin(x - 1, y, x1, y1, x2, y2) or pin(x + 1, y, x1, y1, x2, y2)
	if d == c and c != 0:
		condition2 = pin(x, y - 1, x1, y1, x2, y2) or pin(x, y + 1, x1, y1, x2, y2)
	print(ans[base and condition1 and condition2])


t = int(input())
for tt in range(t):
	(a, b, c, d) = map(int, input().split())
	l = list(map(int, input().split()))
	x = l[0]
	y = l[1]
	x1 = l[2]
	y1 = l[3]
	x2 = l[4]
	y2 = l[5]
	b1 = a - b <= x - x1
	b2 = b - a <= x2 - x
	b3 = c - d <= y - y1
	b4 = d - c <= y2 - y
	if x1 - x2 == 0:
		b1 = a == 0 and b == 0
	if y1 - y2 == 0:
		b3 = c == 0 and d == 0
	if b1 and b2 and b3 and b4:
		print('Yes')
	else:
		print('No')


t = int(input())
for _ in range(t):
	(a, b, c, d) = list(map(int, input().split()))
	(x, y, x1, y1, x2, y2) = list(map(int, input().split()))
	flag1 = abs(a - b) <= x2 - x1
	flag2 = abs(c - d) <= y2 - y1
	if (a > 0 or b > 0) and x2 == x1:
		flag1 = False
	if (c > 0 or d > 0) and y2 == y1:
		flag2 = False
	if a > b:
		flag1 = flag1 and a - b <= x - x1
	elif b > a:
		flag1 = flag1 and b - a <= x2 - x
	else:
		flag1 = flag1 and abs(a - b) <= max(x2 - x, x - x1)
	if c > d:
		flag2 = flag2 and c - d <= y - y1
	elif d > c:
		flag2 = flag2 and d - c <= y2 - y
	else:
		flag2 = flag2 and abs(c - d) <= max(y2 - y, y - y1)
	if flag1 and flag2:
		print('Yes')
	else:
		print('No')


for i in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	dx = b - a
	dy = d - c
	xk = x + dx
	yk = y + dy
	xw = x2 - x1
	yw = y2 - y1
	if x1 <= xk <= x2 and y1 <= yk <= y2:
		if xw == 0 and (a != 0 or b != 0) or (yw == 0 and (c != 0 or d != 0)):
			print('NO')
		else:
			print('YES')
	else:
		print('NO')


import sys
input = sys.stdin.readline
Q = int(input())
Query = []
for _ in range(Q):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	Query.append((a, b, c, d, x, y, x1, y1, x2, y2))
for (a, b, c, d, x, y, x1, y1, x2, y2) in Query:
	lx = x + b - a
	ly = y + d - c
	ok = False
	if x1 <= lx <= x2 and y1 <= ly <= y2:
		if lx == x1 == x2 and a > 0 or (ly == y1 == y2 and d > 0):
			ok = False
		else:
			ok = True
	print('Yes' if ok else 'No')


t = int(input())
for i in range(t):
	m = input()
	m = [int(e) for e in m.split(' ')]
	l = input()
	l = [int(e) for e in l.split(' ')]
	if l[4] == l[2] and m[0] + m[1] > 0 or (l[5] == l[3] and m[2] + m[3] > 0):
		print('No')
	elif l[2] <= l[0] - m[0] + m[1] <= l[4] and l[3] <= l[1] + m[3] - m[2] <= l[5]:
		print('Yes')
	else:
		print('No')


n = int(input())
for i in range(n):
	(a, b, c, d) = map(int, input().split())
	l = list(map(int, input().split()))
	check = 1
	if l[0] - l[2] < a - b or l[4] - l[0] < b - a or l[1] - l[3] < c - d or (l[5] - l[1] < d - c):
		print('NO')
	elif l[4] - l[2] == 0 and a + b > 0 or (l[5] - l[3] == 0 and c + d > 0):
		print('NO')
	else:
		print('YES')


t = int(input())
for i in range(t):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	if x1 == x2 and a == b and (a > 0) or (y1 == y2 and c == d and (c > 0)):
		print('no')
	elif x1 <= x - a + b <= x2 and y1 <= y - c + d <= y2:
		print('yes')
	else:
		print('no')


import sys

def input():
	return sys.stdin.readline().strip()

def iinput():
	return int(input())

def rinput():
	return map(int, input().split())

def rlinput():
	return list(map(int, input().split()))

def main():

	def pro(a, b, x, x1, x2):
		if (a == -2 * b or x != x1 or x != x2 or (b == 0)) and x1 <= x - a + b <= x2:
			return True
		return False
	(a, b, c, d) = rinput()
	(x, y, x1, y1, x2, y2) = rinput()
	if pro(a, b, x, x1, x2) and pro(c, d, y, y1, y2):
		print('YES')
		return 0
	print('NO')
for i in range(iinput()):
	main()


from bisect import bisect_left as bl
from bisect import bisect_right as br
from heapq import heappush, heappop
import math
from collections import *
from functools import reduce, cmp_to_key
import sys
input = sys.stdin.readline
M = mod = 998244353

def factors(n):
	return sorted(set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0))))

def inv_mod(n):
	return pow(n, mod - 2, mod)

def li():
	return [int(i) for i in input().rstrip('\n').split()]

def st():
	return input().rstrip('\n')

def val():
	return int(input().rstrip('\n'))

def li2():
	return [i for i in input().rstrip('\n')]

def li3():
	return [int(i) for i in input().rstrip('\n')]

def check(x, a, b, u, v):
	if b < a:
		fin = min(v, x + b)
		b -= fin - x
		x = fin
		a -= b
		if x - a < u:
			return 0
	else:
		fin = max(u, x - a)
		a -= x - fin
		x = fin
		b -= a
		if x + b > v:
			return 0
	return 1
for _ in range(val()):
	(a, b, c, d) = li()
	(u, v, x1, y1, x2, y2) = li()
	if u < x1 or u > x2 or v < y1 or (v > y2):
		print('NO')
		continue
	if a or b:
		if x1 == x2:
			print('NO')
			continue
	if c or d:
		if y1 == y2:
			print('NO')
			continue
	if check(u, a, b, x1, x2) * check(v, c, d, y1, y2):
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	(a, b, c, d) = map(int, input().split())
	(x, y, u, v, w, z) = map(int, input().split())
	if u == w and a + b or (v == z and c + d):
		print('NO')
	elif u <= x - a + b <= w and v <= y - c + d <= z:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(a, b, c, d) = list(map(int, input().split()))
	(x, y, x1, y1, x2, y2) = list(map(int, input().split()))
	if b != 0 or a != 0:
		if x1 == x2:
			print('No')
			continue
	if c != 0 or d != 0:
		if y1 == y2:
			print('No')
			continue
	if x + b - a in range(x1, x2 + 1) and y + d - c in range(y1, y2 + 1):
		print('Yes')
	else:
		print('No')


a = int(input())
for i in range(a):
	flag = 0
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	r = x2 - x
	l = x - x1
	u = y2 - y
	do = y - y1
	if b - a > r:
		flag = 1
	if a - b > l:
		flag = 1
	if c - d > do:
		flag = 1
	if d - c > u:
		flag = 1
	if y1 == y2:
		if min(c, d) > 0:
			flag = 1
	if x1 == x2:
		if min(a, b) > 0:
			flag = 1
	if flag == 1:
		print('No')
	else:
		print('Yes')


def solve():
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	(hor, ver) = (b - a, d - c)
	x1 -= x
	x2 -= x
	y1 -= y
	y2 -= y
	return x1 <= hor and hor <= x2 and (y1 <= ver) and (ver <= y2) and (abs(x2 - x1) >= 1 or (a == 0 and b == 0)) and (abs(y2 - y1) >= 1 or (c == 0 and d == 0))
t = int(input())
for i in range(t):
	if solve():
		print('Yes')
	else:
		print('No')


from sys import stdin, stdout
ans = ''
for _ in range(int(input())):
	(a, b, c, d) = map(int, stdin.readline().split())
	(x, y, x1, y1, x2, y2) = map(int, stdin.readline().split())
	x2 -= x
	x1 -= x
	y1 -= y
	y2 -= y
	if (x1 == 0 and x2 == 0) and (a != 0 or b != 0):
		ans += 'NO\n'
		continue
	if (y1 == 0 and y2 == 0) and (c != 0 or d != 0):
		ans += 'NO\n'
		continue
	if b != 0 and a != 0:
		if a > b:
			m1 = (a - b) * -1
		else:
			m1 = b - a
	else:
		m1 = -1 * a + b
	if c != 0 and d != 0:
		if c > d:
			m2 = (c - d) * -1
		else:
			m2 = d - c
	else:
		m2 = -1 * c + d
	if x1 <= m1 <= x2 and y1 <= m2 <= y2:
		ans += 'YES\n'
	else:
		ans += 'NO\n'
stdout.write(ans)


def solve():
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	dx = b - a
	dy = d - c
	if x1 == x2:
		if a + b:
			print('No')
			return
	if y1 == y2:
		if c + d:
			print('No')
			return
	if x1 <= x + dx <= x2 and y1 <= y + dy <= y2:
		print('Yes')
	else:
		print('No')
t = int(input())
for _ in range(t):
	solve()


t = int(input())
cnt = 1
for _ in range(555555):
	cnt = cnt * 100
	cnt %= 2
for _ in range(t):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	if x1 == x2 == x:
		if a + b > 0:
			print('No')
			continue
	if y1 == y2 == y:
		if c + d > 0:
			print('No')
			continue
	if x1 <= x - a + b <= x2 and y1 <= y - c + d <= y2:
		print('Yes')
	else:
		print('No')


t = int(input())
for _ in range(t):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	dx = b - a
	dy = d - c
	ans = 'Yes'
	if a + b > 0 and x1 == x2:
		ans = 'No'
	if c + d > 0 and y1 == y2:
		ans = 'No'
	if x + dx < x1 or x + dx > x2:
		ans = 'No'
	if y + dy < y1 or y + dy > y2:
		ans = 'No'
	print(ans)


for _ in range(int(input())):
	(a1, b1, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	count = 0
	if x1 <= x + b1 - a1 <= x2 and x1 != x2 and (a1 + b1 > 0):
		count += a1 + b1
	if y1 <= y + d - c <= y2 and y1 != y2 and (d + c > 0):
		count += d + c
	if count == a1 + b1 + c + d:
		print('Yes')
	else:
		print('No')


for t in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	l = a - b
	u = c - d
	(tx, ty) = (0, 0)
	if x1 == x2 and y1 == y2:
		if a or b or c or (d != 0):
			print('No')
			continue
	if x1 == x and x2 == x:
		if a or b != 0:
			print('No')
			continue
	if y1 == y and y2 == y:
		if c or d != 0:
			print('No')
			continue
	tx = x - 1 * l
	ty = y - 1 * u
	if tx not in range(x1, x2 + 1) or ty not in range(y1, y2 + 1):
		print('No')
	else:
		print('Yes')


def solve(steps, bounds):
	(l, r, d, u) = steps
	(x, y) = bounds[0:2]
	(x1, y1) = bounds[2:4]
	(x2, y2) = bounds[4:6]
	net_x = r - l
	net_y = u - d
	if x2 - x1 == 0 and r + l != 0 or (y2 - y1 == 0 and u + d != 0):
		return 'NO'
	if net_x < 0 or net_y < 0:
		if x + net_x < x1 or y + net_y < y1:
			return 'NO'
	if net_x > 0 or net_y > 0:
		if x + net_x > x2 or y + net_y > y2:
			return 'NO'
	return 'YES'
cases = int(input())
for i in range(cases):
	steps = [int(x) for x in input().split()]
	bounds = [int(x) for x in input().split()]
	print(solve(steps, bounds))


import sys
import math
import bisect
from sys import stdin, stdout
from math import gcd, floor, sqrt, log2, ceil
from collections import defaultdict as dd
from bisect import bisect_left as bl, bisect_right as br
from bisect import insort
from collections import Counter
from collections import deque
from heapq import heappush, heappop, heapify
from itertools import permutations, combinations
mod = int(1000000000.0) + 7
ip = lambda : int(stdin.readline())
inp = lambda : map(int, stdin.readline().split())
ips = lambda : stdin.readline().rstrip()
out = lambda x: stdout.write(str(x) + '\n')
t = ip()
for _ in range(t):
	(a, b, c, d) = inp()
	(x, y, x1, y1, x2, y2) = inp()
	if x1 == x2 and (a > 0 or b > 0):
		ans = 'No'
	elif y1 == y2 and (c > 0 or d > 0):
		ans = 'No'
	else:
		temp = min(a, b)
		a -= temp
		b -= temp
		temp = min(c, d)
		c -= temp
		d -= temp
		if x - a >= x1 and x + b <= x2 and (y - c >= y1) and (y + d <= y2):
			ans = 'Yes'
		else:
			ans = 'No'
	out(ans)


I = lambda : list(map(int, input().split()))
for tc in range(int(input())):
	(a, b, c, d) = I()
	l = I()
	x = l[0]
	y = l[1]
	x += b - a
	y += d - c
	l = l[2:]
	if a + b > 0 and l[0] == l[2]:
		print('NO')
	elif c + d > 0 and l[1] == l[3]:
		print('NO')
	elif x >= l[0] and x <= l[2] and (l[1] <= y <= l[3]):
		print('YES')
	else:
		print('No')


t = int(input())
for _ in range(t):
	(a, b, c, d) = map(int, input().strip().split())
	(x, y, x1, y1, x2, y2) = map(int, input().strip().split())
	cnt = 0
	if b == 0 and a == 0:
		cnt += 1
	elif b == a:
		if x - 1 >= x1 and x - 1 <= x2 or (x + 1 >= x1 and x + 1 <= x2):
			cnt += 1
	elif x + (b - a) >= x1 and x + (b - a) <= x2:
		cnt += 1
	if d == 0 and c == 0:
		cnt += 1
	elif d == c:
		if y - 1 >= y1 and y - 1 <= y2 or (y + 1 >= y1 and y + 1 <= y2):
			cnt += 1
	elif y + (d - c) >= y1 and y + (d - c) <= y2:
		cnt += 1
	if cnt == 2:
		print('Yes')
	else:
		print('No')


t = int(input())
for loop in range(t):
	(a, b, c, d) = map(int, input().split())
	(x, y, l, u, r, D) = map(int, input().split())
	ans = 'Yes'
	if l == r and max(a, b) > 0:
		ans = 'No'
	if u == D and max(c, d) > 0:
		ans = 'No'
	if x - a + b < l or r < x - a + b:
		ans = 'No'
	if y - c + d < u or D < y - c + d:
		ans = 'No'
	print(ans)


def ac(a, x):
	x1 = x[0] + a[1] - a[0]
	y1 = x[1] - a[2] + a[3]
	flag = 1
	if x[5] == x[3] and x[2] == x[4]:
		flag = 0
	if x[2] == x[4] and (a[0] != 0 or a[1] != 0):
		flag = 0
	if x[3] == x[5] and (a[2] != 0 or a[3] != 0):
		flag = 0
	if x1 > x[4] or x1 < x[2]:
		flag = 0
	if y1 < x[3] or y1 > x[5]:
		flag = 0
	if flag == 0:
		return 'NO'
	else:
		return 'YES'
T = int(input())
for i in range(T):
	a = list(map(int, input().rstrip().split()))
	x = list(map(int, input().rstrip().split()))
	result = ac(a, x)
	print(result)


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
for _ in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	if x - x1 < a - b or x2 - x < b - a or y - y1 < c - d or (y2 - y < d - c) or (a + b and x1 == x2) or (c + d and y1 == y2):
		print('NO')
	else:
		print('YES')


test = int(input())
for _ in range(test):
	(l, r, d, u) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	if x2 - x1 == 0 and (l > 0 or r > 0) or (y2 - y1 == 0 and (d > 0 or u > 0)):
		print('No')
	elif x1 <= x - l + r <= x2:
		if y1 <= y + u - d <= y2:
			print('Yes')
		else:
			print('No')
	else:
		print('No')


import sys
t = int(sys.stdin.readline())
for _ in range(t):
	line = sys.stdin.readline().split()
	(a, b, c, d) = (int(line[0]), int(line[1]), int(line[2]), int(line[3]))
	line = sys.stdin.readline().split()
	(x, y, x1) = (int(line[0]), int(line[1]), int(line[2]))
	(y1, x2, y2) = (int(line[3]), int(line[4]), int(line[5]))
	lr = b - a
	ud = d - c
	xf = x + lr
	yf = y + ud
	yes = True
	if xf >= x1 and xf <= x2 and (yf >= y1) and (yf <= y2):
		if a + b > 0:
			if x1 == x == x2:
				yes = False
		if c + d > 0:
			if y1 == y == y2:
				yes = False
	else:
		yes = False
	if yes:
		print('Yes')
	else:
		print('No')


t = int(input())
for _ in range(t):
	abcd = list(map(int, input().split(' ')))
	a = abcd[0]
	b = abcd[1]
	c = abcd[2]
	d = abcd[3]
	xy = list(map(int, input().split(' ')))
	net_lr = a - b
	net_du = c - d
	(x, y) = (xy[0], xy[1])
	(x1, y1) = (xy[2], xy[3])
	(x2, y2) = (xy[4], xy[5])
	if x1 == x2 and x1 == x and (a != 0 or b != 0):
		print('NO')
	elif y1 == y2 and y1 == y and (c != 0 or d != 0):
		print('NO')
	else:
		if net_lr < 0:
			fx = x + abs(net_lr)
		else:
			fx = x - abs(net_lr)
		if net_du < 0:
			fy = y + abs(net_du)
		else:
			fy = y - abs(net_du)
		if fx >= x1 and fx <= x2 and (fy >= y1) and (fy <= y2):
			print('YES')
		else:
			print('NO')


import os
import sys
import math

def algo(a, b, x, x1, x2):
	if a == b == 0:
		return True
	if x1 == x2:
		return False
	if a - b > x - x1 or b - a > x2 - x:
		return False
	else:
		return True
n = int(input())
for i in range(n):
	(a, b, c, d) = list(map(int, input().split()))
	(x, y, x1, y1, x2, y2) = list(map(int, input().split()))
	print('YES' if algo(a, b, x, x1, x2) and algo(c, d, y, y1, y2) else 'NO')


for _ in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	u = b - a + x
	v = d - c + y
	if x1 == x2 and (a != 0 or b != 0) or (y1 == y2 and (d != 0 or c != 0)):
		print('NO')
		continue
	if x1 <= u <= x2 and y1 <= v <= y2:
		print('YES')
		continue
	else:
		print('NO')


def solve():
	(a, b, c, d) = [int(v) for v in input().split()]
	(x, y, x1, y1, x2, y2) = [int(v) for v in input().split()]
	(mxl, mxr) = (x, x)
	(mxd, mxu) = (y, y)
	if a > b:
		mxl = -(a - b) + x
		if mxl < x1:
			print('NO')
			return
	elif a < b:
		mxr = b - a + x
		if mxr > x2:
			print('NO')
			return
	elif a == 0:
		pass
	else:
		mxl = x - 1
		mxr = x + 1
		if mxl < x1 and mxr > x2:
			print('NO')
			return
	if c > d:
		mxd = -(c - d) + y
		if mxd < y1:
			print('NO')
			return
	elif c < d:
		mxu = d - c + y
		if mxu > y2:
			print('NO')
			return
	elif c == 0:
		pass
	else:
		mxd = y - 1
		mxu = y + 1
		if mxd < y1 and mxu > y2:
			print('NO')
			return
	print('YES')
t = int(input())
for _ in range(t):
	solve()


t = int(input())
while t:
	t = t - 1
	(a, b, c, d) = map(int, input().split(' '))
	(x, y, x1, y1, x2, y2) = map(int, input().split(' '))
	xx = b - a + x
	yy = d - c + y
	if x1 <= xx and xx <= x2 and (y1 <= yy) and (yy <= y2):
		if x1 == x2 and a != 0 and (b != 0) or (y1 == y2 and c != 0 and (d != 0)):
			print('No')
		else:
			print('Yes')
	else:
		print('No')


t = int(input())
for _ in range(t):
	(a, b, c, d) = map(int, input().split())
	l = list(map(int, input().split()))
	x = [l[0] - l[2], l[4] - l[0]]
	y = [l[1] - l[3], l[5] - l[1]]
	if l[4] - l[0] + (l[0] - l[2]) == 0 and (a != 0 or b != 0) or (l[5] - l[1] + (l[1] - l[3]) == 0 and (c != 0 or d != 0)):
		print('No')
	elif sum(x) < abs(a - b) or sum(y) < abs(c - d):
		print('No')
	elif x[0] < a - b or x[1] < b - a or y[0] < c - d or (y[1] < d - c):
		print('No')
	else:
		print('Yes')


import sys
input = sys.stdin.readline
t = int(input())
for tests in range(t):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	if x == x1 == x2 and (a > 0 or b > 0):
		print('No')
		continue
	if y == y1 == y2 and (c > 0 or d > 0):
		print('No')
		continue
	if x1 <= x - a + b <= x2 and y1 <= y - c + d <= y2:
		print('Yes')
	else:
		print('No')


def cat_walk(left, right, up, down, x, y, x1, x2, y1, y2):
	horizontal = right - left
	vertical = up - down
	if x == x1 and left > 0 and (right == 0 or x == x2):
		return 'No'
	elif x == x2 and right > 0 and (left == 0 or x == x1):
		return 'No'
	elif y == y1 and down > 0 and (up == 0 or y == y2):
		return 'No'
	elif y == y2 and up > 0 and (down == 0 or y == y1):
		return 'No'
	x += horizontal
	y += vertical
	if x >= x1 and x <= x2:
		if y >= y1 and y <= y2:
			return 'Yes'
	return 'No'
t = int(input())
for x in range(t):
	(l, r, d, u) = list(map(int, input().split()))
	(x, y, x1, y1, x2, y2) = list(map(int, input().split()))
	print(cat_walk(l, r, u, d, x, y, x1, x2, y1, y2))


t = int(input())
for query in range(t):
	abcd = input().split()
	a = int(abcd[0])
	b = int(abcd[1])
	c = int(abcd[2])
	d = int(abcd[3])
	xy = input().split()
	x = int(xy[0])
	y = int(xy[1])
	x1 = int(xy[2])
	y1 = int(xy[3])
	x2 = int(xy[4])
	y2 = int(xy[5])
	ab = a - b
	cd = c - d
	f = 0
	g = 0
	if ab > 0:
		if x - x1 >= ab:
			f = 1
	elif ab < 0:
		if x - x2 <= ab:
			f = 1
	elif a == 0 and b == 0:
		f = 1
	elif x != x1 or x != x2:
		f = 1
	if ab > 0:
		if x - x1 >= ab:
			f = 1
	elif ab < 0:
		if x - x2 <= ab:
			f = 1
	elif a == 0 and b == 0:
		f = 1
	elif x != x1 or x != x2:
		f = 1
	if cd > 0:
		if y - y1 >= cd:
			g = 1
	elif cd < 0:
		if y - y2 <= cd:
			g = 1
	elif c == 0 and d == 0:
		g = 1
	elif y != y1 or y != y2:
		g = 1
	if f and g:
		print('Yes')
	else:
		print('No')


def solve():
	(a, b, c, d, *_) = [int(x) for x in input().split(' ')]
	(x, y, x1, y1, x2, y2, *_) = [int(x) for x in input().split(' ')]
	return b - a <= x2 - x and a - b <= x - x1 and (d - c <= y2 - y) and (c - d <= y - y1) and (c == d == 0 or y2 - y1 >= 1) and (a == b == 0 or x2 - x1 >= 1)

def main():
	t = int(input())
	for _ in range(t):
		print('YES' if solve() else 'NO')
main()


def solve(arr1, arr2):
	[a, b, c, d] = arr1
	[x, y, x1, y1, x2, y2] = arr2
	toMoveRight = b - a
	toMoveUp = d - c
	bool1 = True
	bool2 = True
	if a > 0 or b > 0:
		bool1 = x2 != x1
	if c > 0 or d > 0:
		bool2 = y2 != y1
	if x + toMoveRight <= x2 and x + toMoveRight >= x1:
		if y + toMoveUp <= y2 and y + toMoveUp >= y1:
			if bool1 and bool2:
				print('YES')
				return
	print('NO')
	return
x = int(input())
while x > 0:
	arr1 = list(map(int, input().split()))
	arr2 = list(map(int, input().split()))
	solve(arr1, arr2)
	x -= 1


import math
L = lambda : list(map(int, input().split()))
M = lambda : map(int, input().split())
I = lambda : int(input())
t = I()
for i in range(t):
	(a, b, c, d) = M()
	(x, y, x1, y1, x2, y2) = M()
	if x1 == x2 and a + b > 0:
		print('NO')
	elif y1 == y2 and c + d > 0:
		print('NO')
	elif x1 <= x + b - a <= x2 and y1 <= y + d - c <= y2:
		print('YES')
	else:
		print('NO')


from sys import stdin
import math
inp = lambda : stdin.readline().strip()
t = int(inp())
for i in range(t):
	(l, r, d, u) = [int(x) for x in input().split()]
	(x, y, x1, y1, x2, y2) = [int(x) for x in input().split()]
	if (r > 0 or l > 0) and x1 - x2 == 0:
		print('NO')
	elif (d > 0 or u > 0) and y1 - y2 == 0:
		print('NO')
	elif x1 <= x + (r - l) <= x2 and y1 <= y + (u - d) <= y2:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	dx = abs(x2 - x1)
	dy = abs(y2 - y1)
	if dx == 0 and (a != 0 or b != 0) or (dy == 0 and (c != 0 or d != 0)):
		print('No')
	elif abs(a - b) > dx or abs(c - d) > dy:
		print('No')
	else:
		ddx = x2 - x
		ddy = y2 - y
		if a > b and a - b > dx - ddx or (b > a and b - a > ddx) or (c > d and c - d > dy - ddy) or (d > c and d - c > ddy):
			print('No')
		else:
			print('Yes')


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	(l, r, d, u) = list(map(int, input().split()))
	(x, y, x1, y1, x2, y2) = list(map(int, input().split()))
	x += r - l
	y += u - d
	flag = False
	if x >= x1 and x <= x2 and (y >= y1) and (y <= y2):
		flag = True
	if x1 - x2 == 0 and (l != 0 or r != 0):
		flag = False
	if y1 - y2 == 0 and (d != 0 or u != 0):
		flag = False
	if flag:
		print('Yes')
	else:
		print('No')


for _ in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	lmax = tmax = False
	if y - 1 >= y1 or y + 1 <= y2:
		tmax = True
	if x - 1 >= x1 or x + 1 <= x2:
		lmax = True
	if not lmax and (a > 0 or b > 0) or (not tmax and (c > 0 or d > 0)):
		print('no')
		continue
	if x1 <= b - a + x <= x2 and y1 <= d - c + y <= y2:
		print('yes')
		continue
	print('no')


t = int(input())
for i in range(t):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	f = 0
	if abs(x - x1) == 0 and abs(x - x2) == 0:
		if a > 0 or b > 0:
			f = 1
	if abs(y - y1) == 0 and abs(y - y2) == 0:
		if c > 0 or d > 0:
			f = 1
	if abs(x - x1) < a - b:
		f = 1
	if abs(x - x2) < b - a:
		f = 1
	if abs(y - y1) < c - d:
		f = 1
	if abs(y - y2) < d - c:
		f = 1
	if f == 0:
		print('Yes')
	else:
		print('No')


t = int(input())
mas = []
for i in range(t):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	x_max_otk = -1 * a + 1 * b + x
	y_max_okl = -1 * c + 1 * d + y
	if x1 == x2 and x1 == x and (a != 0) and (b != 0):
		mas.append('NO')
	elif y1 == y2 and y1 == y and (c != 0) and (d != 0):
		mas.append('NO')
	elif x1 <= x_max_otk <= x2 and y1 <= y_max_okl <= y2:
		mas.append('YES')
	else:
		mas.append('NO')
print('\n'.join(mas))


t = int(input())
for _ in range(t):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	(finx, finy) = (b - a, d - c)
	an = 1
	if finx + x >= x1 and finx + x <= x2 and (finy + y >= y1) and (finy + y <= y2):
		if x1 == x2 and a * b:
			an = 0
		elif y1 == y2 and c * d:
			an = 0
		else:
			an = 1
	else:
		an = 0
	if an:
		print('Yes')
	else:
		print('No')


import sys
t = int(sys.stdin.readline())
for _ in range(t):
	(a, b, c, d) = map(int, sys.stdin.readline().split())
	(x, y, x1, y1, x2, y2) = map(int, sys.stdin.readline().split())
	if x1 == x2 and (a != 0 or b != 0):
		print('NO')
	elif y1 == y2 and (c != 0 or d != 0):
		print('NO')
	elif x - (a - b) >= x1 and x + b - a <= x2 and (y - (c - d) >= y1) and (y + d - c <= y2):
		print('YES')
	else:
		print('NO')


import math
for _ in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	lr = abs(a - b)
	ud = abs(c - d)
	flag1 = False
	flag2 = False
	if a > b and x - (a - b) >= x1 or (b > a and x + (b - a) <= x2) or (a == b and (a == 0 or x - 1 >= x1 or x + 1 <= x2)):
		flag1 = True
	if c > d and y - (c - d) >= y1 or (d > c and y + (d - c) <= y2) or (d == c and (c == 0 or y - 1 >= y1 or y + 1 <= y2)):
		flag2 = True
	if flag1 and flag2:
		print('Yes')
	else:
		print('NO')


def check_walk(a, b, c, d, left_right, down_up, x_1, y_1, x_2, y_2):
	if x_1 == x_2 and (a != 0 or b != 0) or (y_1 == y_2 and (c != 0 or d != 0)):
		return 'No'
	if left_right < x_1 or left_right > x_2 or down_up < y_1 or (down_up > y_2):
		return 'No'
	return 'Yes'
test_case = int(input())
for t in range(test_case):
	(a, b, c, d) = [int(x) for x in input().split()]
	(x, y, x_1, y_1, x_2, y_2) = [int(x) for x in input().split()]
	left_right = x - a + b
	down_up = y - c + d
	print(check_walk(a, b, c, d, left_right, down_up, x_1, y_1, x_2, y_2))


t = int(input())
for i in range(t):
	(a, b, c, d) = (int(x) for x in input().split())
	(x, y, x1, y1, x2, y2) = (int(x) for x in input().split())
	xunits = b - a
	yunits = d - c
	xflag = 0
	yflag = 0
	if a == 0 and b == 0:
		xflag = 1
	if c == 0 and d == 0:
		yflag = 1
	if xunits > 0 and x2 - x >= xunits:
		xflag = 1
	elif xunits < 0 and abs(xunits) <= abs(x - x1):
		xflag = 1
	elif xunits == 0 and x2 - x1 >= 1:
		xflag = 1
	if yunits > 0 and y2 - y >= yunits:
		yflag = 1
	elif yunits < 0 and abs(yunits) <= abs(y - y1):
		yflag = 1
	elif yunits == 0 and y2 - y1 >= 1:
		yflag = 1
	if xflag == 1 and yflag == 1:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(l, r, d, u) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	lr = r - l
	du = u - d
	a1 = x2 - x1
	a2 = y2 - y1
	movlr = x + lr
	movdu = y + du
	if x1 <= movlr <= x2:
		if movlr == x and a1 == 0 and (l + r != 0):
			print('NO')
			continue
	else:
		print('NO')
		continue
	if y1 <= movdu <= y2:
		if movdu == y and a2 == 0 and (u + d != 0):
			print('NO')
			continue
	else:
		print('NO')
		continue
	print('YES')


import io, os
R = lambda : map(int, input().split())

def check(x, x1, x2, a, b):
	(la, lb) = (x - x1, x2 - x)
	if la < a:
		(la, lb) = (lb, la)
		(a, b) = (b, a)
	if a > la:
		return False
	if b > a + lb:
		return False
	return True
for _ in range(int(input())):
	(a, b, c, d) = R()
	t1 = min(a, b)
	a -= t1
	b -= t1
	t2 = min(c, d)
	c -= t2
	d -= t2
	(x, y, x1, y1, x2, y2) = R()
	if (x2 - x1 > 0 or t1 == 0) and (y2 - y1 > 0 or t2 == 0) and check(x, x1, x2, a, b) and check(y, y1, y2, c, d):
		print('Yes')
	else:
		print('No')


def does_safe_walk_exists(xpos, ypos, exercise_walk, lower_bound, upper_bound):
	(xlwr, ylwr) = lower_bound
	(xupr, yupr) = upper_bound
	(a, b, c, d) = exercise_walk
	if (b > 0 or a > 0) and xupr - xlwr == 0:
		return False
	if (c > 0 or d > 0) and yupr - ylwr == 0:
		return False
	dx = b - a
	dy = d - c
	if dx != 0:
		if xpos + dx < xlwr or xpos + dx > xupr:
			return False
	if dy != 0:
		if ypos + dy < ylwr or ypos + dy > yupr:
			return False
	return True

def run_alg():
	num_cases = int(input())
	for _ in range(num_cases):
		exercise_line_data = input().split(' ')
		exercise_walk = (int(exercise_line_data[0]), int(exercise_line_data[1]), int(exercise_line_data[2]), int(exercise_line_data[3]))
		pos_line_data = input().split(' ')
		(xpos, ypos) = (int(pos_line_data[0]), int(pos_line_data[1]))
		lower_bound = (int(pos_line_data[2]), int(pos_line_data[3]))
		upper_bound = (int(pos_line_data[4]), int(pos_line_data[5]))
		res = does_safe_walk_exists(xpos, ypos, exercise_walk, lower_bound, upper_bound)
		if res:
			print('YES')
		else:
			print('NO')
run_alg()


import collections
import itertools
from functools import lru_cache
import sys
import math

def helper():
	pass

def solve():
	(a, b, c, d) = map(int, input().split(' '))
	(x, y, x1, y1, x2, y2) = map(int, input().split(' '))
	ev = x + (b - a)
	eh = y + (d - c)
	(vertical, horizontal) = (False, False)
	if not (x >= x1 and x <= x2 and (y >= y1) and (y <= y2)):
		print('No')
		return
	if x2 == x1 and a == b == 0:
		vertical = True
	elif x2 != x1 and ev >= x1 and (ev <= x2):
		vertical = True
	if y2 == y1 and c == d == 0:
		horizontal = True
	elif y2 != y1 and eh >= y1 and (eh <= y2):
		horizontal = True
	if vertical and horizontal:
		print('Yes')
		return
	else:
		print('No')
		return
t = int(input())
for _ in range(t):
	solve()
	pass


t = int(input())
for i in range(t):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	ans1 = False
	ans2 = False
	rs = abs(x2 - x)
	us = abs(y2 - y)
	ds = abs(y - y1)
	ls = abs(x - x1)
	if a > b:
		if ls >= a - b:
			ans1 = True
	elif b - a <= rs:
		ans1 = True
	if d > c:
		if us >= d - c:
			ans2 = True
	elif ds >= c - d:
		ans2 = True
	if rs == 0 and ls == 0:
		if a > 0 or b > 0:
			ans1 = False
	if us == 0 and ds == 0:
		if c > 0 or d > 0:
			ans2 = False
	if ans2 and ans1:
		print('Yes')
	else:
		print('No')


def read():
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	return (a, b, c, d, x, y, x1, y1, x2, y2)

def solve(a, b, c, d, x, y, x1, y1, x2, y2):
	fx = x + b - a
	fy = y + d - c
	can_a = a == 0 or x1 < x or (b > 0 and x2 > x)
	can_b = b == 0 or x2 > x or (a > 0 and x1 < x)
	can_c = c == 0 or y1 < y or (d > 0 and y2 > y)
	can_d = d == 0 or y2 > y or (c > 0 and y1 < y)
	x_valid = x1 <= fx <= x2 and can_a and can_b
	y_valid = y1 <= fy <= y2 and can_c and can_d
	return x_valid and y_valid
for i in range(int(input())):
	result = solve(*read())
	print('YES' if result else 'NO')


t = int(input())
for _ in range(t):
	(a, b, c, d) = map(int, input().split())
	(x, y, p, q, r, s) = map(int, input().split())
	p -= x
	q -= y
	r -= x
	s -= y
	if a == b:
		if a == 0:
			pass
		elif p == r == 0:
			print('No')
			continue
	elif a < b:
		if not b - a <= r:
			print('No')
			continue
	elif not p <= b - a:
		print('No')
		continue
	if c == d:
		if c == 0:
			pass
		elif q == s == 0:
			print('No')
			continue
	elif c < d:
		if not d - c <= s:
			print('No')
			continue
	elif not q <= d - c:
		print('No')
		continue
	print('Yes')


def solve(a, b, c, d, x1, y1, x2, y2):
	if not x1 <= b - a <= x2:
		return 'No'
	if not y1 <= d - c <= y2:
		return 'No'
	if x1 == 0:
		if b == 0 and a > 0:
			return 'No'
		if x2 == 0 and (b != 0 or a != 0):
			return 'No'
	if x2 == 0:
		if b > 0 and a == 0:
			return 'No'
	if y1 == 0:
		if d == 0 and c > 0:
			return 'No'
		if y2 == 0 and (d != 0 or c != 0):
			return 'No'
	if y2 == 0:
		if d > 0 and c == 0:
			return 'No'
	return 'Yes'
t = int(input())
res = []
for i in range(t):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	(x1, x2) = (x1 - x, x2 - x)
	(y1, y2) = (y1 - y, y2 - y)
	res.append(solve(a, b, c, d, x1, y1, x2, y2))
for el in res:
	print(el)


from sys import stdin
input = stdin.readline
import bisect
import math
for xoxo in range(1):
	for _ in range(int(input())):
		(a, b, c, d) = map(int, input().split())
		(x, y, x1, y1, x2, y2) = map(int, input().split())
		ans = 0
		if ans == 0:
			if x1 == x2 and a + b != 0:
				ans = -1
			elif x1 != x2 and abs(a - b) != 0:
				if a > b:
					if x - x1 < a - b:
						ans = -1
				if b > a:
					if x2 - x < b - a:
						ans = -1
		if ans == 0:
			if y1 == y2 and c + d != 0:
				ans = -1
			elif y1 != y2 and abs(c - d) != 0:
				if c > d:
					if y - y1 < c - d:
						ans = -1
				if d > c:
					if y2 - y < d - c:
						ans = -1
		if ans == 0:
			print('YES')
		else:
			print('NO')


from sys import stdin, gettrace
if not gettrace():

	def input():
		return next(stdin)[:-1]

def main():

	def solve():
		(a, b, c, d) = map(int, input().split())
		(x, y, x1, y1, x2, y2) = map(int, input().split())
		fx = x - a + b
		fy = y - c + d
		if x1 == x2 and (a != 0 or b != 0):
			print('No')
			return
		if y1 == y2 and (c != 0 or d != 0):
			print('No')
			return
		if fx >= x1 and fx <= x2 and (fy >= y1) and (fy <= y2):
			print('Yes')
		else:
			print('No')
	q = int(input())
	for _ in range(q):
		solve()
main()


def main():
	t = int(input())
	for _ in range(t):
		(a, b, c, d) = map(int, input().split())
		(x, y, x1, y1, x2, y2) = map(int, input().split())
		if x - 1 >= x1 or x + 1 <= x2:
			mov = a - b
			if mov < 0:
				x -= mov
				if x > x2:
					print('NO')
					continue
			elif mov > 0:
				x -= mov
				if x < x1:
					print('NO')
					continue
		elif b != 0 or a != 0:
			print('NO')
			continue
		if y - 1 >= y1 or y + 1 <= y2:
			mov = c - d
			if mov < 0:
				y -= mov
				if y > y2:
					print('NO')
					continue
			elif mov > 0:
				y -= mov
				if y < y1:
					print('NO')
					continue
		elif d != 0 or c != 0:
			print('NO')
			continue
		print('YES')
	return
main()


n = int(input())
for i in range(n):
	(a, b, c, d) = map(int, input().split())
	dx = b - a
	dy = d - c
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	if abs(x2 - x1) == 0 and a != 0 and (b != 0) or (abs(y2 - y1) == 0 and c != 0 and (d != 0)):
		print('No')
		continue
	if x1 <= x + dx <= x2 and y1 <= y + dy <= y2:
		print('Yes')
	else:
		print('No')


nrew = int(input())
for wew in range(nrew):
	tem = list(map(int, input().split(' ')))
	temp = list(map(int, input().split(' ')))
	x = temp[0]
	y = temp[1]
	x1 = temp[2]
	y1 = temp[3]
	x2 = temp[4]
	y2 = temp[5]
	flag = 0
	t1 = abs(tem[0] - tem[1])
	t2 = abs(tem[2] - tem[3])
	if x == x1 == x2 and tem[0] != 0 and (tem[1] != 0):
		flag = 1
	if y == y1 == y2 and tem[2] != 0 and (tem[3] != 0):
		flag = 1
	if t1 > 0:
		if tem[1] > tem[0]:
			if x2 - x < t1:
				flag = 1
		elif x - x1 < t1:
			flag = 1
	if t2 > 0:
		if tem[3] > tem[2]:
			if y2 - y < t2:
				flag = 1
		elif y - y1 < t2:
			flag = 1
	if flag == 1:
		print('NO')
	else:
		print('YES')


cantidad_movimientos = int(input())
list_imprimir = []
for repetir in range(cantidad_movimientos):
	cond_x = True
	cond_y = True
	(left, right, down, up) = input().split(' ')
	(inicial_x, inicial_y, x1, y1, x2, y2) = input().split(' ')
	resultado_x = int(inicial_x) + int(right) - int(left)
	resultado_y = int(inicial_y) + int(up) - int(down)
	if x1 == x2 and y1 == y2:
		if left == '0' and right == '0' and (up == '0') and (down == '0'):
			pass
		else:
			cond_x = False
			cond_y = False
	elif x1 == x2 and y1 != y2:
		if left == '0' and right == '0':
			if resultado_y >= int(y1) and resultado_y <= int(y2):
				pass
			else:
				cond_y = False
		else:
			cond_x = False
	elif int(x1) != int(x2) and int(y1) == int(y2):
		if down == '0' and up == '0':
			if resultado_x >= int(x1) and resultado_x <= int(x2):
				pass
			else:
				cond_x = False
		else:
			cond_y = False
	elif not (resultado_x >= int(x1) and resultado_x <= int(x2) and (resultado_y >= int(y1)) and (resultado_y <= int(y2))):
		cond_y = False
		cond_x = False
	if cond_y and cond_x:
		list_imprimir.append('YES')
	else:
		list_imprimir.append('NO')
for elementos in list_imprimir:
	print(elementos)


import math
import sys
input = sys.stdin.readline
t = int(input())
for i in range(t):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	d1 = b - a
	d2 = d - c
	f1 = False
	if x1 == x2:
		if a == 0 and b == 0:
			f1 = True
		else:
			f1 = False
	elif d1 == 0:
		f1 = True
	elif d1 > 0:
		if x2 - x >= d1:
			f1 = True
		else:
			f1 = False
	elif x - x1 >= abs(d1):
		f1 = True
	else:
		f1 = False
	f2 = False
	if y1 == y2:
		if c == 0 and d == 0:
			f2 = True
		else:
			f2 = False
	elif d2 == 0:
		f2 = True
	elif d2 > 0:
		if y2 - y >= d2:
			f2 = True
		else:
			f2 = False
	elif y - y1 >= abs(d2):
		f2 = True
	else:
		f2 = False
	if f1 and f2:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	flag = True
	if x2 == x and x1 == x and (a > 0 or b > 0):
		print('NO')
		continue
	if y2 == y and y1 == y and (c > 0 or d > 0):
		print('NO')
		continue
	hMove = b - a
	vMove = d - c
	if x + hMove < x1 or x + hMove > x2:
		print('NO')
		continue
	if y + vMove < y1 or y + vMove > y2:
		print('NO')
		continue
	print('YES')


x = int(input())
out = []
for a in range(0, x):
	y = input().split()
	y1 = input().split()
	for b in range(0, 4):
		y[b] = int(y[b])
	for b in range(0, 6):
		y1[b] = int(y1[b])
	fac = True
	if abs(y1[2] - y1[0]) < y[0]:
		if abs(y1[2] - y1[0]) < y[0] - y[1] or (abs(y1[4] - y1[2]) == 0 and y[1] > 0 and (y[0] > 0)):
			fac = False
	if abs(y1[4] - y1[0]) < y[1]:
		if abs(y1[4] - y1[0]) < y[1] - y[0] or (abs(y1[4] - y1[2]) == 0 and y[1] > 0 and (y[0] > 0)):
			fac = False
	if abs(y1[3] - y1[1]) < y[2]:
		if abs(y1[3] - y1[1]) < y[2] - y[3] or (abs(y1[5] - y1[3]) == 0 and y[2] > 0 and (y[3] > 0)):
			fac = False
	if abs(y1[5] - y1[1]) < y[3]:
		if abs(y1[5] - y1[1]) < y[3] - y[2] or (abs(y1[5] - y1[3]) == 0 and y[2] > 0 and (y[3] > 0)):
			fac = False
	if fac:
		out.append('Yes')
	else:
		out.append('No')
for each in out:
	print(each)


import sys
input = sys.stdin.readline
for ti in range(int(input().strip())):
	(a, b, c, d) = [int(x) for x in input().strip().split()]
	(x, y, x1, y1, x2, y2) = [int(x) for x in input().strip().split()]
	ans = True
	a1 = a
	l = x - x1
	a = max(0, a - l)
	x1 = max(x - a1, x1)
	if a or b:
		if 0 <= b - a <= x2 - x1 and x2 - x1 > 0:
			ans = True
		else:
			ans = False
	l = y - y1
	c1 = c
	c = max(0, c - l)
	y1 = max(y - c1, y1)
	if c or d:
		if 0 <= d - c <= y2 - y1 and y2 - y1 > 0:
			ans = ans and True
		else:
			ans = ans and False
	if ans:
		print('Yes')
	else:
		print('No')


t = int(input())
for i in range(t):
	(l, r, d, u) = map(int, input().strip().split())
	(x, y, x1, y1, x2, y2) = map(int, input().strip().split())
	xf = x - l + r
	yf = y - d + u
	if x1 <= xf <= x2 and y1 <= yf <= y2:
		if l != 0 and r != 0 and (x2 - x1 == 0):
			print('NO')
		elif d != 0 and u != 0 and (y2 - y1 == 0):
			print('NO')
		else:
			print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	b = 0
	x = list(map(int, input().split()))
	c = list(map(int, input().split()))
	h = x[0] - x[1]
	v = x[2] - x[3]
	if h < 0:
		if c[4] - c[0] < -h:
			b += 1
	elif c[0] - c[2] < h:
		b += 1
	if v < 0:
		if c[5] - c[1] < -v:
			b += 1
	elif c[1] - c[3] < v:
		b += 1
	if c[4] - c[2] == 0 and x[0] + x[1] > 0 or (c[5] - c[3] == 0 and x[2] + x[3] > 0):
		b += 1
	if b == 0:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	can = (x1 - x, x2 - x, y1 - y, y2 - y)
	p = b - a
	q = d - c
	if p == 0 and b != 0:
		p = 1
		pp = -1
	else:
		pp = p
	if q == 0 and d != 0:
		q = 1
		qq = -1
	else:
		qq = q
	if can[0] <= p <= can[1] and can[2] <= q <= can[3] or (can[0] <= p <= can[1] and can[2] <= qq <= can[3]) or (can[0] <= pp <= can[1] and can[2] <= q <= can[3]) or (can[0] <= pp <= can[1] and can[2] <= qq <= can[3]):
		print('Yes')
	else:
		print('No')


for i in range(int(input())):
	ans = 'YES'
	(a, b, c, d) = [int(s) for s in input().split()]
	(x, y, x1, y1, x2, y2) = [int(s) for s in input().split()]
	if x1 == x2 and a + b != 0:
		ans = 'NO'
	if y1 == y2 and c + d != 0:
		ans = 'NO'
	if x - x1 < a - b:
		ans = 'NO'
	if x2 - x < b - a:
		ans = 'NO'
	if y - y1 < c - d:
		ans = 'NO'
	if y2 - y < d - c:
		ans = 'NO'
	print(ans)


cases = int(input())
for cas in range(cases):
	(a, b, c, d) = map(int, input().split(' '))
	(x, y, x1, y1, x2, y2) = map(int, input().split(' '))
	horizontal = True
	vertical = True
	if x1 == x2 and (a != 0 or b != 0):
		horizontal = False
	if a > b:
		if x - x1 < a - b:
			horizontal = False
	elif x2 - x < b - a:
		horizontal = False
	if y1 == y2 and (c != 0 or d != 0):
		vertical = False
	if c > d:
		if y - y1 < c - d:
			vertical = False
	elif y2 - y < d - c:
		vertical = False
	val = horizontal and vertical
	msg = 'YES' if val else 'NO'
	print(msg)


t = int(input())
for __ in range(t):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	if a + b > 0 and x2 - x == 0 == x - x1:
		print('No')
		continue
	if c + d > 0 and y2 - y == 0 == y - y1:
		print('No')
		continue
	if x2 - x < b - a:
		print('No')
		continue
	if y2 - y < d - c:
		print('No')
		continue
	if x - x1 < a - b:
		print('No')
		continue
	if y - y1 < c - d:
		print('No')
		continue
	print('Yes')


for i in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	e = b - a
	f = d - c
	g = 0
	if a > 0 and b > 0:
		if x1 <= x - min(1, a) <= x2 or x1 <= x + min(1, b) <= x2:
			pass
		else:
			g = -1
	if c > 0 and d > 0:
		if y1 <= y - min(1, c) <= y2 or y1 <= y + min(1, d) <= y2:
			pass
		else:
			g = -1
	if g == -1:
		print('NO')
	else:
		x = x + e
		y = y + f
		if x1 <= x <= x2 and y1 <= y <= y2:
			print('YES')
		else:
			print('NO')


t = int(input())
for _ in range(t):
	(a, b, c, d) = map(int, input().split())
	(x, y, p, q, r, s) = map(int, input().split())
	val1 = b - a + x
	val2 = d - c + y
	if a + b > 0 and p == r or (c + d > 0 and q == s):
		print('NO')
		continue
	if val1 >= p and val1 <= r and (val2 >= q) and (val2 <= s):
		print('YES')
	else:
		print('NO')


def main():
	import sys
	input = sys.stdin.buffer.readline
	for t in range(int(input())):
		(l, r, d, u) = map(int, input().split())
		(x, y, x1, y1, x2, y2) = map(int, input().split())
		(X, Y) = (x + (r - l), y + (u - d))
		if X < x1 or X > x2 or Y < y1 or (Y > y2):
			print('No')
		else:
			ok = 1
			if x1 == x2:
				if l != 0 or r != 0:
					ok = 0
			if y1 == y2:
				if u != 0 or d != 0:
					ok = 0
			if ok:
				print('Yes')
			else:
				print('No')
main()


t = int(input())

def check(x1, x2, a1, b1):
	return x2 - x1 == 0 and (a1 != 0 or b1 != 0)
for _ in range(t):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	a1 = a
	b1 = b
	c1 = c
	d1 = d
	max_a = x - x1
	max_b = x2 - x
	max_c = y - y1
	max_d = y2 - y
	if a > b:
		a = a - b
		b = 0
	else:
		b = b - a
		a = 0
	if c > d:
		c = c - d
		d = 0
	else:
		d = d - c
		c = 0
	if a > max_a or b > max_b or c > max_c or (d > max_d) or check(x1, x2, a1, b1) or check(y1, y2, c1, d1):
		print('NO')
	else:
		print('YES')


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	(left, right, up, down) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	if (left or right) and x1 == x2 or ((up or down) and y1 == y2):
		print('No')
		continue
	if x1 <= x + (right - left) <= x2 and y1 <= y + (down - up) <= y2:
		print('Yes')
	else:
		print('No')


y = int(input())
ans = []
for i in range(y):
	al = input().split()
	m = list(map(int, al))
	al = input().split()
	g = list(map(int, al))
	if g[2] <= g[0] + m[1] - m[0] and g[0] + m[1] - m[0] <= g[4] and (g[3] <= g[1] + m[3] - m[2]) and (g[1] + m[3] - m[2] <= g[5]) and (g[2] < g[4] or m[0] + m[1] == 0) and (g[3] < g[5] or m[2] + m[3] == 0):
		ans.append('Yes')
	else:
		ans.append('No')
for i in ans:
	print(i)


from bisect import bisect_left as bl, bisect_right as br, insort
import sys
import heapq
from collections import defaultdict as dd, deque

def data():
	return sys.stdin.readline().strip()

def mdata():
	return map(int, data().split())
for i in range(int(data())):
	(a, b, c, d) = mdata()
	(x, y, x1, y1, x2, y2) = mdata()
	x0 = a - b
	y0 = c - d
	if x1 <= x - x0 <= x2 and y1 <= y - y0 <= y2:
		if a == b and a != 0 and (x2 - x1 == 0):
			print('NO')
		elif c == d and c != 0 and (y1 - y2 == 0):
			print('NO')
		else:
			print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	(a, b, c, d) = map(int, input().strip().split())
	(x, y, x1, y1, x2, y2) = map(int, input().strip().split())
	val = abs(x - x1)
	val1 = abs(x - x2)
	val2 = abs(y - y1)
	val3 = abs(y - y2)
	k = 0
	m = 0
	n = 0
	if x == y == x1 == y1 == x2 == y2:
		print('NO')
		k = 1
	if x1 == x2 and (a > 0 or b > 0) and (k != 1):
		print('NO')
		m = 1
	if y1 == y2 and (c > 0 or d > 0) and (k != 1) and (m != 1):
		print('NO')
		n = 1
	if a <= val + b and b <= val1 + a and (c <= val2 + d) and (d <= c + val3) and (k != 1) and (m != 1) and (n != 1):
		print('YES')
	elif k != 1 and m != 1 and (n != 1):
		print('NO')


for test in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	check = True
	dx = b - a
	if dx == 0:
		if a != 0 or b != 0:
			if not x1 <= x - 1 <= x2 and (not x1 <= x + 1 <= x2):
				check = False
		elif not x1 <= x <= x2:
			check = False
	elif not x1 <= dx + x <= x2:
		check = False
	dy = d - c
	if dy == 0:
		if d != 0 or c != 0:
			if not y1 <= y - 1 <= y2 and (not y1 <= y + 1 <= y2):
				check = False
		elif not y1 <= y <= y2:
			check = False
	elif not y1 <= dy + y <= y2:
		check = False
	if check:
		print('Yes')
	else:
		print('No')


n = int(input())
for _ in range(n):
	(a, b, c, d) = map(int, input().split())
	(p, q, r, s, t, w) = map(int, input().split())
	m = 0
	if r == t:
		if a != 0 or b != 0:
			m = -1
		else:
			m += 1
	elif p + (b - a) <= t and p + (b - a) >= r:
		m += 1
	if s == w:
		if c != 0 or d != 0:
			m = -1
		else:
			m += 1
	elif q + (d - c) <= w and q + (d - c) >= s:
		m += 1
	if m == 2:
		print('YES')
	else:
		print('NO')


for t in range(int(input())):
	(a, b, c, d) = map(int, input().split(' '))
	(x, y, x_1, y_1, x_2, y_2) = map(int, input().split(' '))
	if x_1 == x_2 and a + b > 0:
		print('NO')
	elif y_1 == y_2 and c + d > 0:
		print('NO')
	elif x_1 <= x - a + b <= x_2 and y_1 <= y - c + d <= y_2:
		print('Yes')
	else:
		print('No')


def readln():
	return input().strip()

def main():
	n = int(readln())
	for _ in range(n):
		(a, b, c, d) = [int(x) for x in readln().split()]
		(x, y, x1, y1, x2, y2) = [int(x) for x in readln().split()]
		x1 = x1 - x
		x2 = x2 - x
		y1 = y1 - y
		y2 = y2 - y
		dx = b - a
		dy = d - c
		u = x + dx
		v = y + dy
		success = True
		if dx < x1 or dx > x2 or dy < y1 or (dy > y2):
			success = False
		elif (a > 0 or b > 0) and x2 == x1:
			success = False
		elif (c > 0 or d > 0) and y1 == y2:
			success = False
		if success:
			print('Yes')
		else:
			print('No')
main()


a = int(input())
for _ in range(a):
	v = 0
	(a, b, c, d) = list(map(int, input().split()))
	ar2 = list(map(int, input().split()))
	if a != 0 or b != 0:
		if ar2[2] - ar2[4] != 0 and b - a + ar2[0] <= ar2[4] and (b - a + ar2[0] >= ar2[2]):
			v += 1
	else:
		v += 1
	if c != 0 or d != 0:
		if ar2[3] - ar2[5] != 0 and d - c + ar2[1] <= ar2[5] and (d - c + ar2[1] >= ar2[3]):
			v += 1
	else:
		v += 1
	if v == 2:
		print('YES')
	else:
		print('NO')


l = int(input())
for i in range(l):
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	c = a[0]
	t = 0
	d = a[1]
	k = b[0] + d - c
	s = b[0] + 1
	if b[0] + 1 in range(b[2], b[4] + 1) or b[0] - 1 in range(b[2], b[4] + 1):
		if k in range(b[2], b[4] + 1):
			t = 0
		else:
			t = 1
	elif c == 0 and d == 0:
		pass
	else:
		t = 1
	e = b[1] + a[3] - a[2]
	f = 0
	if b[1] + 1 in range(b[3], b[5] + 1) or b[1] - 1 in range(b[3], b[5] + 1):
		if e in range(b[3], b[5] + 1):
			f = 0
		else:
			f = 1
	elif a[2] == 0 and a[3] == 0:
		f = 0
	else:
		f = 1
	if t == 0 and f == 0:
		print('Yes')
	else:
		print('No')


for _ in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	flag = 0
	if a == 0 and b == 0:
		flag += 1
	elif a > b and x - x1 >= a - b:
		flag += 1
	elif b > a and x2 - x >= b - a:
		flag += 1
	elif a == b and (x2 - x > 0 or x - x1 > 0):
		flag += 1
	if c == 0 and d == 0:
		flag += 1
	elif c > d and y - y1 >= c - d:
		flag += 1
	elif d > c and y2 - y >= d - c:
		flag += 1
	elif c == d and (y - y1 > 0 or y2 - y > 0):
		flag += 1
	if flag == 2:
		print('YES')
	else:
		print('NO')


def solve(a, b, c, d, x, y, x1, y1, x2, y2):
	if x1 == x2 and (a != 0 or b != 0):
		return False
	if y1 == y2 and (c != 0 or d != 0):
		return False
	x1 = x1 - x
	x2 = x2 - x
	y1 = y1 - y
	y2 = y2 - y
	diff_h = b - a
	diff_v = d - c
	return diff_h <= x2 and diff_h >= x1 and (diff_v <= y2) and (diff_v >= y1)
t = int(input())
for _ in range(t):
	(a, b, c, d) = [int(r) for r in input().split()]
	(x, y, x1, y1, x2, y2) = [int(r) for r in input().split()]
	if solve(a, b, c, d, x, y, x1, y1, x2, y2):
		print('Yes')
	else:
		print('No')


def solve(a, b, c, d, x, y, x1, y1, x2, y2):
	if x1 <= x - a + b <= x2 and y1 <= y - c + d <= y2:
		if x1 == x == x2 and a != 0 or (x1 == x == x2 and b != 0) or (y1 == y == y2 and c != 0) or (y1 == y == y2 and d != 0):
			return 'No'
		return 'Yes'
	return 'No'

def main():
	T = int(input())
	res = []
	while T:
		(a, b, c, d) = [int(x) for x in input().split()]
		(x, y, x1, y1, x2, y2) = [int(x) for x in input().split()]
		res.append(solve(a, b, c, d, x, y, x1, y1, x2, y2))
		T -= 1
	for ans in res:
		print(ans)
main()


t = int(input())
for _ in range(t):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	hor_delta = b - a
	ver_delta = d - c
	finish_x = x + hor_delta
	finish_y = y + ver_delta
	gave_ans = False
	if not (finish_x >= x1 and finish_x <= x2 and (finish_y >= y1) and (finish_y <= y2)):
		print('No')
		gave_ans = True
	if not gave_ans and x2 - x1 < 1 and (a + b > 0):
		print('No')
		gave_ans = True
	if not gave_ans and y2 - y1 < 1 and (c + d > 0):
		print('No')
		gave_ans = True
	if not gave_ans:
		print('Yes')


for i in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	side = b - a
	ud = d - c
	if x1 == x2 and (a > 0 or b > 0):
		print('NO')
		continue
	if y1 == y2 and (c > 0 or d > 0):
		print('NO')
		continue
	x += side
	y += ud
	if x > x2 or x < x1 or y > y2 or (y < y1):
		print('NO')
	else:
		print('YES')


t = int(input())
l = [(list(map(int, input().split())), list(map(int, input().split()))) for i in range(t)]
for q in l:
	if q[1][0] - q[0][0] + q[0][1] in range(q[1][2], q[1][4] + 1) and q[1][1] - q[0][2] + q[0][3] in range(q[1][3], q[1][5] + 1):
		if q[1][4] - q[1][2] == 0 and max(q[0][0], q[0][1]) > 0 or (q[1][5] - q[1][3] == 0 and max(q[0][2], q[0][3]) > 0):
			print('No')
		else:
			print('Yes')
	else:
		print('No')


import sys
readLine = lambda : sys.stdin.readline()
readInt = lambda : int(sys.stdin.readline())
readInts = lambda : [int(x) for x in sys.stdin.readline().split(' ')]

def main():
	solns = []
	t = readInt()
	for _ in range(t):
		(a, b, c, d) = readInts()
		x_disp = b - a
		y_disp = d - c
		(x, y, x1, y1, x2, y2) = readInts()
		good = 'Yes'
		if x2 == x1 and (a > 0 or b > 0):
			good = 'No'
		elif y2 == y1 and (c > 0 or d > 0):
			good = 'No'
		elif x_disp + x > x2 or x + x_disp < x1:
			good = 'No'
		elif y_disp + y > y2 or y_disp + y < y1:
			good = 'No'
		solns.append(good)
	print('\n'.join(solns))
main()


from collections import Counter
from collections import defaultdict
import math
t = int(input())
for _ in range(0, t):
	(a, b, c, d) = list(map(int, input().split()))
	(x, y, x1, y1, x2, y2) = list(map(int, input().split()))
	s1 = a - b
	s2 = b - a
	s3 = c - d
	s4 = d - c
	f1 = 0
	f2 = 0
	if s1 >= 0:
		if x - s1 >= x1:
			f1 = 1
	if s2 >= 0:
		if x + s2 <= x2:
			f1 = 1
	if s3 >= 0:
		if y - s3 >= y1:
			f2 = 1
	if s4 >= 0:
		if y + s4 <= y2:
			f2 = 1
	if x1 == x2 == x and a != 0 and (b != 0):
		print('No')
		continue
	if y1 == y2 == y and c != 0 and (d != 0):
		print('No')
		continue
	if f1 == 1 and f2 == 1:
		print('Yes')
	else:
		print('No')


t = int(input())
for i in range(t):
	inp1 = [int(x) for x in input().split()]
	(a, b, c, d) = inp1
	inp2 = [int(x) for x in input().split()]
	(x, y, x1, y1, x2, y2) = inp2
	if x1 == x2 and (a or b):
		print('NO')
		continue
	if y1 == y2 and (c or d):
		print('NO')
		continue
	if a >= b:
		da = a - b
		dx1 = abs(x - x1)
		if dx1 < da:
			print('NO')
			continue
	else:
		db = b - a
		dx2 = abs(x2 - x)
		if dx2 < db:
			print('NO')
			continue
	if c >= d:
		dc = c - d
		dy1 = abs(y - y1)
		if dy1 < dc:
			print('NO')
			continue
	else:
		dd = d - c
		dy2 = abs(y2 - y)
		if dy2 < dd:
			print('NO')
			continue
	print('YES')


import sys
t = -1
k = int(input())

def input():
	global t
	t += 1
	return data[t]
data = sys.stdin.readlines()
for i in range(k):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	f = True
	if x - x1 + b - a < 0 or (b > 0 and x1 == x == x2):
		f = False
	if x2 - x - b + a < 0 or (a > 0 and x1 == x == x2):
		f = False
	if y - y1 + d - c < 0 or (c > 0 and y1 == y == y2):
		f = False
	if y2 - y + c - d < 0 or (d > 0 and y1 == y == y2):
		f = False
	if f:
		print('Yes')
	else:
		print('No')


test_cases = int(input())
for test in range(test_cases):
	line = input().split(' ')
	(a, b, c, d) = [int(i) for i in line]
	line = input().split(' ')
	(x, y, x_1, y_1, x_2, y_2) = [int(i) for i in line]
	horizontal = abs(a - b)
	vertical = abs(c - d)
	if (a > 0 or b > 0) and x_1 == x_2 or ((c > 0 or d > 0) and y_1 == y_2):
		print('No')
	elif (a >= b and x - horizontal >= x_1 or (b > a and x + horizontal <= x_2)) and (c >= d and y - vertical >= y_1 or (d > c and y + vertical <= y_2)):
		print('Yes')
	else:
		print('No')


from sys import stdin, stdout

def main():
	t = int(stdin.readline())
	for _ in range(t):
		(a, b, c, d) = list(map(int, stdin.readline().split()))
		(x, y, x1, y1, x2, y2) = list(map(int, stdin.readline().split()))
		max_left = x - x1
		max_right = x2 - x
		if a > b:
			if a - b > max_left:
				stdout.write('NO\n')
				continue
		elif b > a:
			if b - a > max_right:
				stdout.write('NO\n')
				continue
		elif a == 0:
			pass
		elif max_left > 0 or max_right > 0:
			pass
		else:
			stdout.write('NO\n')
			continue
		max_bot = y - y1
		max_top = y2 - y
		if c > d:
			if c - d > max_bot:
				stdout.write('NO\n')
				continue
		elif d > c:
			if d - c > max_top:
				stdout.write('NO\n')
				continue
		elif c == 0:
			pass
		elif max_bot > 0 or max_top > 0:
			pass
		else:
			stdout.write('NO\n')
			continue
		stdout.write('YES\n')
main()


import math
import string
e = int(input())
for i in range(e):
	f = input().split(' ')
	g = input().split(' ')
	x = int(g[0])
	y = int(g[1])
	x1 = int(g[2])
	y1 = int(g[3])
	x2 = int(g[4])
	y2 = int(g[5])
	a = -int(f[0])
	b = int(f[1])
	c = -int(f[2])
	d = int(f[3])
	if a == 0 and b == 0:
		if c == 0 and d == 0:
			print('YES')
		elif y1 < y or y2 > y:
			if c + d <= 0:
				if y1 <= y + (c + d):
					print('YES')
				else:
					print('NO')
			elif y2 >= y + (c + d):
				print('YES')
			else:
				print('NO')
		else:
			print('NO')
	elif c == 0 and d == 0:
		if x1 < x or x2 > x:
			if a + b <= 0:
				if x1 <= x + (a + b):
					print('YES')
				else:
					print('NO')
			elif x2 >= x + (a + b):
				print('YES')
			else:
				print('NO')
		else:
			print('NO')
	elif (x1 < x or x2 > x) and (y1 < y or y2 > y):
		if a + b <= 0:
			if x1 <= x + (a + b):
				if c + d <= 0:
					if y1 <= y + (c + d):
						print('YES')
					else:
						print('NO')
				elif y2 >= y + (c + d):
					print('YES')
				else:
					print('NO')
			else:
				print('NO')
		elif x2 >= x + (a + b):
			if c + d <= 0:
				if y1 <= y + (c + d):
					print('YES')
				else:
					print('NO')
			elif y2 >= y + (c + d):
				print('YES')
			else:
				print('NO')
		else:
			print('NO')
	else:
		print('NO')


t = int(input())
for i in range(t):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	xx = x - a + b
	yy = y - c + d
	flag = 0
	if (x1 <= xx and xx <= x2) and (y1 <= yy and yy <= y2):
		if a > 0 or b > 0:
			if x - 1 >= x1 or x + 1 <= x2:
				flag = 0
			else:
				flag = 1
		if flag == 0:
			if c > 0 or d > 0:
				if y - 1 >= y1 or y + 1 <= y2:
					flag = 0
				else:
					flag = 1
		if flag == 0:
			print('Yes')
		else:
			print('No')
	else:
		print('No')


t = int(input())
if t < 1 or t > 10 ** 3:
	print('nonono dude')
for i in range(int(t)):
	(a, b, c, d) = [int(i) for i in input().split()]
	(x, y, x_1, y_1, x_2, y_2) = [int(i) for i in input().split()]
	if x_1 == x_2 and a + b != 0 or (y_1 == y_2 and c + d != 0):
		print('No')
	elif x_1 <= x + b - a <= x_2 and y_1 <= y + d - c <= y_2:
		print('Yes')
	else:
		print('No')


t = int(input())
while t:
	t -= 1
	(left, right, down, up) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	movement_x = x - left + right
	movement_y = y - down + up
	if movement_x >= x1 and movement_x <= x2 and (movement_y >= y1) and (movement_y <= y2) and (x1 < x2 or left + right == 0) and (y1 < y2 or up + down == 0):
		print('Yes')
	else:
		print('No')


x = int(input())
for i in range(x):
	(a, b, c, d) = list(map(int, input().split(' ')))
	(x, y, x1, y1, x2, y2) = list(map(int, input().split(' ')))
	flag = False
	if x < x1 or x > x2 or y < y1 or (y > y2) or (x == x1 and x == x2 and (y == y1) and (y == y2)):
		flag = False
	elif a > 0 and b > 0 and (x == x1) and (x == x2) or (c > 0 and d > 0 and (y == y1) and (y == y2)):
		flag = False
	elif x1 <= x - a + b and x - a + b <= x2:
		if y1 <= y - c + d and y - c + d <= y2:
			flag = True
	if flag:
		print('YES')
	else:
		print('NO')


for krya in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	tr = True
	if x1 == x2:
		if b != 0 or a != 0:
			print('NO')
			tr = False
	if tr and y1 == y2:
		if d != 0 or c != 0:
			print('NO')
			tr = False
	if tr:
		xper = b - a
		yper = d - c
		if x1 <= x + xper <= x2 and y1 <= y + yper <= y2:
			print('YES')
		else:
			print('NO')


from math import *
for zz in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	res = x - x1 >= a - b and x2 - x >= b - a and (y - y1 >= c - d) and (y2 - y >= d - c)
	if (a > 0 or b > 0) and x2 - x1 == 0:
		res = False
	if (c > 0 or d > 0) and y2 - y1 == 0:
		res = False
	if res:
		print('YES')
	else:
		print('No')


import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	(a, b, cc, dd) = map(int, input().split())
	(x, y, l, d, r, u) = map(int, input().split())
	x += b - a
	y += dd - cc
	if x in range(l, r + 1) and y in range(d, u + 1):
		if a + b > 0 and l == r:
			print('NO')
			continue
		if cc + dd > 0 and d == u:
			print('NO')
			continue
		print('YES')
	else:
		print('NO')


cases = int(input())
for _ in range(cases):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	r1 = x - a + b
	r2 = y - c + d
	if r1 >= x1 and r1 <= x2 and (r2 >= y1) and (r2 <= y2) and (x2 > x1 or a + b == 0) and (y2 > y1 or c + d == 0):
		print('Yes')
	else:
		print('No')


import math
from bisect import bisect_left, bisect, bisect_right
from itertools import accumulate
from math import sqrt as sq

def transformer(i):
	if i == 'd' or i == 'f':
		return 1
	return 0

def changer(i):
	if i == 0:
		return 1
	return 0
st = ''
p = pow(10, 9) + 7

def func(a, b, c, d, x, x1, x2, y, y1, y2):
	if abs(x2 - x1) == 0 and abs(y2 - y1) == 0:
		return 'NO'
	leftspace = abs(x - x1)
	rightspace = abs(x2 - x)
	downspace = abs(y - y1)
	upspace = abs(y2 - y)
	if a >= b:
		if a - b > leftspace or (leftspace + rightspace == 0 and (a != 0 or b != 0)):
			return 'NO'
	elif b - a > rightspace or (leftspace + rightspace == 0 and (a != 0 or b != 0)):
		return 'NO'
	if c >= d:
		if c - d > downspace or (upspace + downspace == 0 and (c != 0 or d != 0)):
			return 'NO'
	elif d - c > upspace:
		return 'NO'
	return 'YES'
for i in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	st += str(func(a, b, c, d, x, x1, x2, y, y1, y2)) + '\n'
print(st)


t = int(input())
for _ in range(t):
	(a, b, c, d) = map(int, input().strip().split())
	(x, y, x1, y1, x2, y2) = map(int, input().strip().split())
	max_xL = abs(x - x1)
	max_xR = abs(x - x2)
	max_yU = abs(y - y2)
	max_yD = abs(y - y1)
	if max_xL == 0 and max_xR == 0 and (a > 0 or b > 0):
		print('NO')
	elif max_yU == 0 and max_yD == 0 and (c > 0 or d > 0):
		print('No')
	elif max_xL >= a - b and max_xR >= b - a:
		if max_yU >= d - c and max_yD >= c - d:
			print('Yes')
		else:
			print('No')
	else:
		print('No')


import sys
import math
input = sys.stdin.readline

def main():
	for _ in range(int(input())):
		(a, b, c, d) = map(int, input().split())
		(x, y, x1, y1, x2, y2) = map(int, input().split())
		if (a != 0 or b != 0) and x1 == x2:
			print('No')
			continue
		if (c != 0 or d != 0) and y1 == y2:
			print('No')
			continue
		if a >= b:
			a -= b
			b = 0
			if a > x - x1:
				print('No')
				continue
		else:
			b -= a
			a = 0
			if b > x2 - x:
				print('No')
				continue
		if c >= d:
			c -= d
			d = 0
			if c > y - y1:
				print('No')
				continue
		else:
			d -= c
			c = 0
			if d > y2 - y:
				print('No')
				continue
		print('Yes')
main()


import sys
t = int(sys.stdin.readline())

def re(l, r, d, u, x, y, x1, y1, x2, y2):
	if l > 0 or r > 0:
		if x1 > x - 1 and x + 1 > x2:
			return 0
	if u > 0 or d > 0:
		if y1 > y - 1 and y + 1 > y2:
			return 0
	if (x1 <= x - l + r and x - l + r <= x2) and (y1 <= y + u - d and y + u - d <= y2):
		return 1
	else:
		return 0
for i in range(t):
	lrdu = [int(e) for e in sys.stdin.readline().split()]
	xy = [int(f) for f in sys.stdin.readline().split()]
	l = lrdu[0]
	r = lrdu[1]
	d = lrdu[2]
	u = lrdu[3]
	x = xy[0]
	y = xy[1]
	x1 = xy[2]
	y1 = xy[3]
	x2 = xy[4]
	y2 = xy[5]
	out = re(l, r, d, u, x, y, x1, y1, x2, y2)
	if out == 0:
		print('No')
	elif out == 1:
		print('Yes')


def checkab(a, b, x, x1, x2):
	if a > b:
		a = a - b
		if x - x1 >= a:
			return 'YES'
		else:
			return 'NO'
	else:
		b = b - a
		if x2 - x >= b:
			return 'YES'
		else:
			return 'NO'

def checkcd(c, d, y, y1, y2):
	if d > c:
		d = d - c
		if y2 - y >= d:
			return 'YES'
		else:
			return 'NO'
	else:
		c = c - d
		if y - y1 >= c:
			return 'YES'
		else:
			return 'NO'
t = int(input())
while t > 0:
	t -= 1
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	if abs(x2 - x1) == 0 and abs(y2 - y1) == 0:
		print('NO')
	elif abs(x2 - x1) == 0:
		if a > 0 or b > 0:
			print('NO')
		else:
			print(checkcd(c, d, y, y1, y2))
	elif abs(y2 - y1) == 0:
		if c > 0 or d > 0:
			print('NO')
		else:
			print(checkab(a, b, x, x1, x2))
	else:
		temp = min(a, b, c, d)
		a = a - temp
		b = b - temp
		c = c - temp
		d = d - temp
		temp = checkcd(c, d, y, y1, y2)
		if temp == 'NO':
			print('NO')
		else:
			temp = checkab(a, b, x, x1, x2)
			if temp == 'NO':
				print('NO')
			else:
				print('YES')


def judge(l, r, now, ll, rr):
	if l == 0:
		return ll <= now <= rr and ll <= now + r <= rr
	if r == 0:
		return ll <= now <= rr and ll <= now - l <= rr
	if l >= r:
		l1 = min(now - 1, now - (l - r))
		r1 = now
	else:
		l1 = now - 1
		r1 = now + r - l
	if l >= r:
		l2 = now - (l - r)
		r2 = now + 1
	else:
		l2 = now
		r2 = max(now + 1, now + (r - l))
	return ll <= l1 <= rr and ll <= r1 <= rr or (ll <= l2 <= rr and ll <= r2 <= rr)
t = int(input())
for _ in range(t):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	if judge(a, b, x, x1, x2) and judge(c, d, y, y1, y2):
		print('Yes')
	else:
		print('No')


t = int(input())
for kk in range(t):
	(a, b, c, d) = list(map(int, input().split()))
	(x, y, x1, y1, x2, y2) = list(map(int, input().split()))
	flag = 0
	if (x1 < x2 or a + b == 0) and x1 <= -a + b + x <= x2:
		flag += 1
	if (y1 < y2 or c + d == 0) and y1 <= -c + d + y <= y2:
		flag += 1
	if flag == 2:
		print('Yes')
	else:
		print('No')


T = int(input())
abcd = [0] * T
xys = [0] * T
for t in range(T):
	abcd[t] = [int(i) for i in input().split(' ')]
	xys[t] = [int(i) for i in input().split(' ')]

def ans(abcd, xys):
	(x, y, x1, y1, x2, y2) = xys
	(a, b, c, d) = abcd
	if x2 - x1 == 0 and (a != 0 or b != 0) or (y2 - y1 == 0 and (c != 0 or d != 0)):
		return 'No'
	if (x + b - a > x2 or x - a + b < x1) or (y + d - c > y2 or y + d - c < y1):
		return 'No'
	return 'Yes'
for t in range(T):
	print(ans(abcd[t], xys[t]))


t = int(input())
for _ in range(t):
	(a, b, c, d) = list(map(int, input().split()))
	(x, y, x1, y1, x2, y2) = list(map(int, input().split()))
	dx = b - a
	dy = d - c
	if x1 == x2 == x and (a != 0 or b != 0):
		print('NO')
	elif y1 == y2 == y and (d != 0 or c != 0):
		print('NO')
	elif x1 <= x + dx and x + dx <= x2 and (y1 <= y + dy) and (y + dy <= y2):
		print('YES')
	else:
		print('NO')


input = __import__('sys').stdin.readline
print = __import__('sys').stdout.write
for _ in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	if x1 == x2:
		if not (a == 0 and b == 0):
			print('No\n')
			continue
	if y1 == y2:
		if not (c == 0 and d == 0):
			print('No\n')
			continue
	if x - x1 < max(a - b, 0):
		print('No\n')
		continue
	if x2 - x < max(b - a, 0):
		print('No\n')
		continue
	if y - y1 < max(c - d, 0):
		print('No\n')
		continue
	if y2 - y < max(d - c, 0):
		print('No\n')
		continue
	print('Yes\n')


def solve():
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	xm = b - a
	ym = d - c
	can = True
	if x + xm < x1 or x + xm > x2 or y + ym < y1 or (y + ym > y2):
		can = False
	if x == x2 and x == x1 and (b > 0 or a > 0):
		can = False
	if y == y2 and y == y1 and (d > 0 or c > 0):
		can = False
	if can:
		print('Yes')
	else:
		print('No')

def main():
	t = int(input())
	for _ in range(t):
		solve()
main()


for nt in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	up = d - c + y
	right = b - a + x
	if x1 == x2:
		if a != 0 or b != 0:
			print('NO')
			continue
	if y1 == y2:
		if c != 0 or d != 0:
			print('NO')
			continue
	if x <= x2 and x >= x1 and (y <= y2) and (y >= y1):
		if up <= y2 and up >= y1 and (right <= x2) and (right >= x1):
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


for _ in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	ans = 'YES'
	if a > b:
		if a - b > abs(x1 - x):
			ans = 'NO'
	elif a < b:
		if b - a > abs(x2 - x):
			ans = 'NO'
	elif abs(x1 - x) < 1 and abs(x2 - x) < 1 and (a > 0):
		ans = 'NO'
	if c > d:
		if c - d > abs(y1 - y):
			ans = 'NO'
	elif c < d:
		if d - c > abs(y2 - y):
			ans = 'NO'
	elif abs(y1 - y) < 1 and abs(y2 - y) < 1 and (c > 0):
		ans = 'NO'
	print(ans)


for i in range(int(input())):
	(left, right, down, up) = map(int, input().split())
	(x0, y0, x1, y1, x2, y2) = map(int, input().split())
	if x1 <= x0 + right - left <= x2 and y1 <= y0 + up - down <= y2:
		if x1 == x2 and right != 0:
			print('No')
			continue
		if y1 == y2 and up != 0:
			print('No')
			continue
		print('Yes')
	else:
		print('No')


for _ in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	aa = b - a
	bb = d - c
	if x1 == x and x == x2:
		if a == 0 and b == 0:
			pass
		else:
			print('NO')
			continue
	if y == y1 and y == y2:
		if c == 0 and d == 0:
			pass
		else:
			print('NO')
			continue
	x = x + aa
	y = y + bb
	if x >= x1 and x <= x2 and (y >= y1) and (y <= y2):
		print('YES')
		continue
	print('NO')


t = int(input())
while t > 0:
	t -= 1
	(a, b, c, d) = [int(x) for x in input().split()]
	(x0, y0, x1, y1, x2, y2) = [int(x) for x in input().split()]
	res = True
	if not (x1 <= x0 - a + b <= x2 and (x0 - 1 >= x1 or x0 + 1 <= x2) or (a == 0 and b == 0)):
		res = False
	if not (y1 <= y0 - c + d <= y2 and (y0 - 1 >= y1 or y0 + 1 <= y2) or (c == 0 and d == 0)):
		res = False
	print('Yes' if res else 'No')


t = int(input())
for rep in range(t):
	(a, b, c, d) = list(map(int, input().split()))
	(x, y, x1, y1, x2, y2) = list(map(int, input().split()))
	hor = b - a
	ver = d - c
	if x1 == x2 and a != 0 and (b != 0):
		print('No')
	elif y1 == y2 and c != 0 and (d != 0):
		print('No')
	elif x + hor >= x1 and x + hor <= x2 and (y + ver >= y1) and (y + ver <= y2):
		print('Yes')
	else:
		print('No')


import sys

def main():
	n = int(input())
	for _ in range(n):
		(a, b, c, d) = map(int, sys.stdin.readline().split())
		(x, y, x1, y1, x2, y2) = map(int, sys.stdin.readline().split())
		if not x1 <= x <= x2 or not y1 <= y <= y2:
			print('No')
			continue
		if x1 == x2 and (a or b):
			print('No')
			continue
		if y1 == y2 and (c or d):
			print('No')
			continue
		xMove = b - a
		yMove = d - c
		if xMove > 0 and x2 - x < xMove or (xMove < 0 and x - x1 < -xMove):
			print('No')
			continue
		if yMove > 0 and y2 - y < yMove or (yMove < 0 and y - y1 < -yMove):
			print('No')
			continue
		print('Yes')
	return
main()


for _ in range(int(input())):
	(a, b, c, d) = (int(x) for x in input().split())
	(x, y, x1, y1, x2, y2) = (int(x) for x in input().split())
	p = a - b
	q = c - d
	if abs(x1 - x2) > 0 or (a == 0 and b == 0):
		if x - p >= x1 and x - p <= x2:
			if abs(y1 - y2) > 0 or (c == 0 and d == 0):
				if y - q >= y1 and y - q <= y2:
					print('YES')
				else:
					print('NO')
			else:
				print('NO')
		else:
			print('NO')
	else:
		print('NO')


for _ in range(int(input())):
	X = list(map(int, input().split()))
	Positions = list(map(int, input().split()))
	LeftRight = X[1] - X[0]
	UpDown = X[3] - X[2]
	Check = True
	if LeftRight == 0:
		if Positions[0] == Positions[2] == Positions[4] and X[0] != 0:
			Check = False
	if UpDown == 0:
		if Positions[1] == Positions[3] == Positions[5] and X[2] != 0:
			Check = False
	if Check == False:
		print('NO')
	else:
		print('YES' if X[1] - X[0] + Positions[0] in range(Positions[2], Positions[4] + 1) and X[3] - X[2] + Positions[1] in range(Positions[3], Positions[5] + 1) else 'NO')


t = int(input())
for i in range(t):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	if x1 <= x - a + b <= x2 and y1 <= y - c + d <= y2 and (x1 <= x <= x2) and (y1 <= y <= y2) and (x + min(1, max(a, b)) <= x2 or x - min(1, max(a, b)) >= x1) and (y + min(1, max(c, d)) <= y2 or y - min(1, max(c, d)) >= y1):
		print('Yes')
	else:
		print('No')


import sys
import math
import itertools
import functools
import collections
import operator
import fileinput
import copy
ORDA = 97

def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return [int(i) for i in input().split()]

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)

def revn(n):
	return str(n)[::-1]

def dd():
	return collections.defaultdict(int)

def ddl():
	return collections.defaultdict(list)

def sieve(n):
	if n < 2:
		return list()
	prime = [True for _ in range(n + 1)]
	p = 3
	while p * p <= n:
		if prime[p]:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 2
	r = [2]
	for p in range(3, n + 1, 2):
		if prime[p]:
			r.append(p)
	return r

def divs(n, start=1):
	r = []
	for i in range(start, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n / i == i:
				r.append(i)
			else:
				r.extend([i, n // i])
	return r

def divn(n, primes):
	divs_number = 1
	for i in primes:
		if n == 1:
			return divs_number
		t = 1
		while n % i == 0:
			t += 1
			n //= i
		divs_number *= t

def prime(n):
	if n == 2:
		return True
	if n % 2 == 0 or n <= 1:
		return False
	sqr = int(math.sqrt(n)) + 1
	for d in range(3, sqr, 2):
		if n % d == 0:
			return False
	return True

def convn(number, base):
	newnumber = 0
	while number > 0:
		newnumber += number % base
		number //= base
	return newnumber

def cdiv(n, k):
	return n // k + (n % k != 0)
for _ in range(ii()):
	(a, b, c, d) = mi()
	(x, y, x1, y1, x2, y2) = mi()
	if x1 == x2 and a + b != 0 or (x1 != x2 and x + b - a < x1) or (x1 != x2 and x + b - a > x2) or (y1 == y2 and c + d != 0) or (y1 != y2 and y + d - c < y1) or (y1 != y2 and y + d - c > y2):
		print('No')
	else:
		print('Yes')


def main():
	case = 0
	cases = 0
	lineNum = 0
	cases = int(input())
	for i in range(0, cases):
		(a, b, c, d) = map(int, input().split())
		(x, y, x1, y1, x2, y2) = map(int, input().split())
		if possibleWalk(a, b, c, d, x, y, x1, y1, x2, y2):
			print('Yes')
		else:
			print('No')

def possibleWalk(a, b, c, d, x, y, x1, y1, x2, y2):
	netx = b - a
	nety = d - c
	maxx = x2 - x
	minx = x1 - x
	maxy = y2 - y
	miny = y1 - y
	if x1 == x2 and a + b > 0 or (y1 == y2 and c + d > 0):
		return False
	if (netx <= maxx and netx >= minx) and (nety <= maxy and nety >= miny):
		return True
	else:
		return False
main()


t = int(input())
for i in range(t):
	l = list(map(int, input().split()))
	k = list(map(int, input().split()))
	u = k[0]
	v = k[1]
	x1 = k[2]
	y1 = k[3]
	x2 = k[4]
	y2 = k[5]
	a = l[0]
	b = l[1]
	c = l[2]
	d = l[3]
	e = abs(a - b)
	f = abs(c - d)
	r = [abs(u - x1), abs(u - x2), abs(v - y1), abs(v - y2)]
	count = 0
	if e > r[0] and a > b:
		count = count + 1
	if e > r[1] and b > a:
		count = count + 1
	if f > r[2] and c > d:
		count = count + 1
	if f > r[3] and d > c:
		count = count + 1
	if x1 == x2 and a != 0 and (b != 0):
		count = count + 1
	if y1 == y2 and c != 0 and (d != 0):
		count = count + 1
	if count == 0 or (a == 0 and b == 0 and (c == 0) and (d == 0)):
		print('YES')
	else:
		print('NO')


from math import ceil
t = int(input())
for _ in range(t):
	(a, b, c, d) = [int(i) for i in input().split(' ')]
	(x, y, x1, y1, x2, y2) = [int(i) for i in input().split(' ')]
	if x1 == x2 and a + b > 0:
		print('NO')
	elif y1 == y2 and c + d > 0:
		print('NO')
	elif x1 <= x + b - a <= x2 and y1 <= y + d - c <= y2:
		print('YES')
	else:
		print('NO')


from sys import exit as sys_return
for _ in range(int(input())):
	(left, right, down, up) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	if x > x2 or x < x1 or y > y2 or (y < y1):
		print('NO')
		continue
	if abs(x2 - x1) == 0 and left + right > 0:
		print('NO')
		continue
	if abs(y2 - y1) == 0 and down + up > 0:
		print('NO')
		continue
	left -= abs(x - x1)
	x = x1
	up -= abs(y2 - y)
	y = y2
	min_horiz = min(left, right)
	min_vert = min(down, up)
	left -= min_horiz
	right -= min_horiz
	down -= min_vert
	up -= min_vert
	if left > 0 or up > 0 or right + x > x2 or (y - down < y1):
		print('NO')
		continue
	print('YES')


for _ in range(int(input())):
	(a, b, c, d) = list(map(int, input().strip().split()))
	(x, y, x1, y1, x2, y2) = list(map(int, input().strip().split()))
	flag = False
	if x1 <= b - a + x <= x2 and y1 <= d - c + y <= y2:
		if max(a, b) and x1 == x2:
			flag = False
		elif max(c, d) and y1 == y2:
			flag = False
		else:
			flag = True
	if flag:
		print('Yes')
	else:
		print('No')


import sys, os.path
import math
if os.path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
for _ in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	x += b - a
	y += d - c
	if a + b > 0 and x1 == x2:
		print('No')
	elif c + d > 0 and y1 == y2:
		print('No')
	elif x1 <= x <= x2 and y1 <= y <= y2:
		print('Yes')
	else:
		print('No')


for _ in range(int(input().strip())):
	(a, b, c, d) = map(int, input().strip().split())
	(x, y, x1, y1, x2, y2) = map(int, input().strip().split())
	flag = True
	t = b - a + x
	if t <= x2 and t >= x1:
		pass
	else:
		flag = False
	t = d - c + y
	if t <= y2 and t >= y1:
		pass
	else:
		flag = False
	if y1 == y2 and (c != 0 or d != 0):
		flag = False
	if x1 == x2 and (a != 0 or b != 0):
		flag = False
	if flag:
		print('YES')
	else:
		print('NO')


n = input()
for i in range(int(n)):
	s1 = input()
	(a, b, c, d) = list(map(int, s1.split()))
	s2 = input()
	(x, y, x1, y1, x2, y2) = list(map(int, s2.split()))
	correct = True
	if a > b and x1 == x:
		correct = False
	if a < b and x2 == x:
		correct = False
	if c > d and y1 == y:
		correct = False
	if c < d and y2 == y:
		correct = False
	if a + b > 0 and x1 == x == x2:
		correct = False
	if c + d > 0 and y1 == y == y2:
		correct = False
	if a > b and x - a + b < x1:
		correct = False
	if a < b and x - a + b > x2:
		correct = False
	if c > d and y - c + d < y1:
		correct = False
	if c < d and y - c + d > y2:
		correct = False
	if correct:
		print('YES')
	else:
		print('NO')


n = int(input())
for a in range(n):
	abcd = list(map(int, input().split()))
	xy = list(map(int, input().split()))
	if xy[0] - abcd[0] + abcd[1] >= xy[2] and xy[0] - abcd[0] + abcd[1] <= xy[4]:
		if xy[1] - abcd[2] + abcd[3] >= xy[3] and xy[1] - abcd[2] + abcd[3] <= xy[5]:
			if abcd[0] == abcd[1] and xy[0] == xy[2] and (xy[0] == xy[4]) and (abcd[0] != 0):
				print('NO')
			elif abcd[2] == abcd[3] and xy[1] == xy[3] and (xy[1] == xy[5]) and (abcd[2] != 0):
				print('NO')
			else:
				print('YES')
		else:
			print('NO')
	else:
		print('NO')


for i in ' ' * int(input()):
	(a, b, c, d) = map(int, input().split())
	(u, v, x1, y1, x2, y2) = map(int, input().split())
	x = b - a
	y = d - c
	if x1 > u + x or x2 < u + x or y1 > v + y or (y2 < v + y):
		print('No')
		continue
	if x == 0 and a:
		if u == x1 == x2:
			print('No')
			continue
	if y == 0 and c:
		if v == y1 == y2:
			print('No')
			continue
	print('Yes')


def main():
	t = int(input())
	for __ in range(t):
		(a, b, c, d) = map(int, input().split())
		(x, y, x1, y1, x2, y2) = map(int, input().split())
		flag = True
		if x1 == x2 and (a > 0 and b > 0):
			flag = False
		elif y1 == y2 and (c > 0 and d > 0):
			flag = False
		if not flag:
			print('No')
		elif x1 <= x - a + b <= x2 and y1 <= y - c + d <= y2:
			print('Yes')
		else:
			print('No')
main()


from sys import *
input = stdin.readline
for _ in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	h = b - a
	v = d - c
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	(x1, x2) = (min(x1, x2), max(x1, x2))
	(y1, y2) = (min(y1, y2), max(y1, y2))
	rl = x + h
	ud = y + v
	ch = 0
	if x1 <= rl <= x2 and y1 <= ud <= y2:
		ch = 1
	else:
		ch = 0
	if h == 0 and ch == 1:
		if x1 <= rl + 1 <= x2:
			ch = 1
		elif x1 <= rl - 1 <= x2:
			ch = 1
		elif a == 0 and b == 0:
			ch = 1
		else:
			ch = 0
	if v == 0 and ch == 1:
		if y1 <= ud + 1 <= y2:
			ch = 1
		elif y1 <= ud - 1 <= y2:
			ch = 1
		elif c == 0 and d == 0:
			ch = 1
		else:
			ch = 0
	if ch == 1:
		stdout.write('YES' + '\n')
	else:
		stdout.write('NO' + '\n')


def main():
	result = str()
	for _ in range(int(input())):
		(a, b, c, d) = map(int, input().split())
		(x, y, x1, y1, x2, y2) = map(int, input().split())
		if (x1 <= x + b - a <= x2 and y1 <= y + d - c <= y2) and ((x1 != x2 or a + b == 0) and (y1 != y2 or c + d == 0)):
			result += 'YES\n'
		else:
			result += 'NO\n'
	print(result.strip())
main()


t = int(input())
for i in range(t):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	ans = True
	if a - b > x - x1:
		ans = False
	if b - a > x2 - x:
		ans = False
	if c - d > y - y1:
		ans = False
	if d - c > y2 - y:
		ans = False
	if x1 == x2:
		if a != 0 or b != 0:
			ans = False
	if y1 == y2:
		if c != 0 or d != 0:
			ans = False
	if ans == True:
		print('Yes')
	else:
		print('No')


T = int(input())
for i in range(T):
	(m, n, o, p) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	x += n - m
	y += p - o
	if m + n > 0 and x1 == x2:
		print('No')
	elif o + p > 0 and y1 == y2:
		print('No')
	elif x1 <= x <= x2 and y1 <= y <= y2:
		print('Yes')
	else:
		print('No')


k = list(map(int, input().split()))
n = k[0]
s = ''
for i in range(n):
	k = list(map(int, input().split()))
	a = k[0]
	b = k[1]
	c = k[2]
	d = k[3]
	k = list(map(int, input().split()))
	x = k[0]
	y = k[1]
	x1 = k[2]
	y1 = k[3]
	x2 = k[4]
	y2 = k[5]
	x = x - a + b
	y = y - c + d
	s = 'no'
	if x >= x1 and x <= x2 and (y >= y1) and (y <= y2):
		if x1 == x2 and a + b > 0 or (y1 == y2 and c + d > 0):
			s = 'no'
		else:
			s = 'yes'
	print(s)


from sys import stdin, stdout

def read():
	x0 = stdin.readline().rstrip()
	return x0

def __main__():
	t = int(read())
	for t0 in range(t):
		(a, b, c, d) = map(int, read().split())
		(x, y, x1, y1, x2, y2) = map(int, read().split())
		x_end = x + b - a
		y_end = y + d - c
		fl = True
		if x_end < x1 or x_end > x2:
			fl = False
		if y_end < y1 or y_end > y2:
			fl = False
		if x1 == x and x2 == x and (a != 0 or b != 0):
			fl = False
		if y1 == y and y2 == y and (c != 0 or d != 0):
			fl = False
		if fl:
			res = 'YES' + '\n'
		else:
			res = 'NO' + '\n'
		stdout.write(res)
__main__()


for i in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	n = b - a
	u = d - c
	flag1 = 0
	flag2 = 0
	if a + b == 0:
		flag1 = 1
	elif x1 != x2 and x1 <= x + n <= x2:
		flag1 = 1
	if c + d == 0:
		flag2 = 1
	elif y1 != y2 and y1 <= y + u <= y2:
		flag2 = 1
	if flag1 * flag2:
		print('YES')
	else:
		print('NO')


def check_dim(a, b, x0, x1, x2):
	if x2 - x1 == 0:
		if a == 0 and b == 0:
			return True
		else:
			return False
	if a > b:
		return x0 - x1 >= a - b
	else:
		return x2 - x0 >= b - a
t = int(input())
for it in range(0, t):
	[a, b, c, d] = map(int, input().split())
	[x0, y0, x1, y1, x2, y2] = map(int, input().split())
	exists = check_dim(a, b, x0, x1, x2) and check_dim(c, d, y0, y1, y2)
	print('Yes') if exists else print('No')


t = int(input())
ans = []
for i in range(0, t):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	answer = 'Yes'
	if a > b:
		if a - b > x - x1:
			answer = 'No'
	elif b > a:
		if b - a > x2 - x:
			answer = 'No'
	elif a != 0 and x == x1 and (x == x2):
		answer = 'No'
	if c > d:
		if c - d > y - y1:
			answer = 'No'
	elif d > c:
		if d - c > y2 - y:
			answer = 'No'
	elif c != 0 and y == y1 and (y == y2):
		answer = 'No'
	ans.append(answer)
for i in range(0, t):
	print(ans[i])


t = int(input())
for i in range(t):
	(l, r, d, u) = list(map(int, input().split()))
	(x, y, x1, y1, x2, y2) = list(map(int, input().split()))
	rl = r - l
	ud = u - d
	newx = x + rl
	newy = y + ud
	if x1 <= newx <= x2 and y1 <= newy <= y2:
		if r > 0 or l > 0:
			if x - 1 < x1 and x + 1 > x2:
				print('NO')
				continue
		if u > 0 or d > 0:
			if y - 1 < y1 and y + 1 > y2:
				print('NO')
				continue
		print('YES')
		continue
	print('NO')


for _ in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	print(['Yes', 'No'][x1 == x2 and a + b > 0 or (y1 == y2 and c + d > 0) or (not (x1 <= x + b - a <= x2 and y1 <= y + d - c <= y2))])


for _ in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	k = b - a
	k1 = d - c
	if min(a, b) >= 1 and x2 - x1 == 0:
		print('No')
	elif min(c, d) >= 1 and y2 - y1 == 0:
		print('No')
	elif x + k >= x1 and x + k <= x2 and (y + k1 >= y1) and (y + k1 <= y2):
		print('Yes')
	else:
		print('No')


t = int(input())
for i in range(t):
	arr = list(map(int, input().split()))
	a = arr[0]
	b = arr[1]
	c = arr[2]
	d = arr[3]
	arr1 = list(map(int, input().split()))
	x1 = arr1[0]
	x2 = arr1[1]
	x3 = arr1[2]
	y1 = arr1[3]
	x4 = arr1[4]
	y2 = arr1[5]
	d1 = b - a
	d2 = d - c
	sum = 0
	if (x1 != x3 or x1 != x4) and (x2 != y1 or x2 != y2):
		c1 = x1 + d1
		c2 = x2 + d2
		if x3 <= c1 <= x4 and y1 <= c2 <= y2:
			print('Yes')
		else:
			print('No')
	elif (x1 == x3 and x1 == x4) and (x2 != y1 or x2 != y2):
		if a == 0 and b == 0:
			c1 = x1 + d1
			c2 = x2 + d2
			if x3 <= c1 <= x4 and y1 <= c2 <= y2:
				print('Yes')
			else:
				print('No')
		else:
			print('No')
	elif (x1 != x3 or x1 != x4) and (x2 == y1 and x2 == y2):
		if c == 0 and d == 0:
			c1 = x1 + d1
			c2 = x2 + d2
			if x3 <= c1 <= x4 and y1 <= c2 <= y2:
				print('Yes')
			else:
				print('No')
		else:
			print('No')
	elif (x1 == x3 and x1 == x4) and (x2 == y1 and x2 == y2):
		if c == 0 and d == 0 and (a == 0) and (b == 0):
			c1 = x1 + d1
			c2 = x2 + d2
			if x3 <= c1 <= x4 and y1 <= c2 <= y2:
				print('Yes')
			else:
				print('No')
		print('No')
	else:
		print('No')


for _ in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	diff_H = b - a
	diff_V = d - c
	ans1 = False
	ans2 = False
	if diff_H < 0 and abs(diff_H) <= x - x1:
		ans1 = True
	elif diff_H >= 0 and diff_H <= x2 - x:
		ans1 = True
	if diff_V < 0 and abs(diff_V) <= y - y1:
		ans2 = True
	elif diff_V >= 0 and diff_V <= y2 - y:
		ans2 = True
	if x1 == x and x2 == x:
		if a == b == 0:
			ans1 = True
		else:
			ans1 = False
	if y1 == y and y2 == y:
		if c == d == 0:
			ans2 = True
		else:
			ans2 = False
	if ans1 and ans2:
		print('Yes')
	else:
		print('No')


task_number = int(input())
for _ in range(task_number):
	(left, right, down, up) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	(left_gap, right_gap, down_gap, up_gap) = (x - x1, x2 - x, y - y1, y2 - y)
	if left + right > 0 and left_gap + right_gap == 0:
		print('NO')
		continue
	if down + up > 0 and down_gap + up_gap == 0:
		print('NO')
		continue
	if max(0, left - right) > left_gap or max(0, right - left) > right_gap:
		print('NO')
		continue
	if max(0, up - down) > up_gap or max(0, down - up) > down_gap:
		print('NO')
		continue
	print('YES')


for _ in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	if x2 == x1 and a != 0 and (b != 0):
		print('No')
		continue
	if y2 == y1 and c != 0 and (d != 0):
		print('No')
		continue
	p = min(a, x - x1)
	x -= p
	a -= p
	q = min(c, y - y1)
	y -= q
	c -= q
	b -= a
	d -= c
	x += b
	y += d
	if x <= x2 and x >= x1 and (y <= y2) and (y >= y1):
		print('Yes')
	else:
		print('No')


t = int(input())
for i in range(0, t):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	xaxis = b - a + x
	yaxis = d - c + y
	f1 = 0
	f2 = 0
	if xaxis <= x2 and xaxis >= x1 and (x >= x1) and (x <= x2):
		if x == x2 and x == x1:
			if a == 0 and b == 0:
				f1 = 1
		else:
			f1 = 1
	if yaxis <= y2 and yaxis >= y1 and (y >= y1) and (y <= y2):
		if y == y2 and y == y1:
			if c == 0 and d == 0:
				f2 = 1
		else:
			f2 = 1
	if f1 == 1 and f2 == 1:
		print('YES')
	else:
		print('NO')


t = int(input())
out = []
for i in range(t):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	x += b - a
	y += d - c
	if a + b > 0 and x1 == x2:
		out.append('No')
	elif c + d > 0 and y1 == y2:
		out.append('No')
	elif x1 <= x <= x2 and y1 <= y <= y2:
		out.append('Yes')
	else:
		out.append('No')
res = '\n'.join(out)
print(res)


for i in range(int(input())):
	listxy = list(map(int, input().split()))
	listxy[0] *= -1
	listxy[2] *= -1
	listmaxxy = [0, 0]
	temp = [listxy[0] + listxy[1], listxy[2] + listxy[3]]
	for u in range(2):
		if abs(temp[u]) > 0:
			listmaxxy[u] = temp[u]
	matrix = list(map(int, input().split()))
	if listxy[0] == -1 * listxy[1] and listxy[0] != 0:
		if matrix[4] - matrix[0] == 0:
			listmaxxy[0] = -1
		else:
			listmaxxy[0] = 1
	if listxy[2] == -1 * listxy[3] and listxy[2] != 0:
		if matrix[5] - matrix[1] == 0:
			listmaxxy[1] = -1
		else:
			listmaxxy[1] = 1
	if matrix[2] <= matrix[0] + listmaxxy[0] and matrix[0] + listmaxxy[0] <= matrix[4]:
		if matrix[3] <= matrix[1] + listmaxxy[1] and matrix[1] + listmaxxy[1] <= matrix[5]:
			print('Yes')
		else:
			print('No')
	else:
		print('No')


t = int(input())
for case in range(t):
	(a, b, c, d) = [int(z) for z in input().split(' ')]
	(x, y, x1, y1, x2, y2) = [int(z) for z in input().split(' ')]
	if x2 - x >= b - a and x - x1 >= a - b and (y2 - y >= d - c) and (y - y1 >= c - d) and (x2 > x1 or max(a, b) == 0) and (y2 > y1 or max(c, d) == 0):
		ans = 'Yes'
	else:
		ans = 'No'
	print(ans)


import sys
t = int(sys.stdin.readline())
for _ in range(t):
	(a, b, c, d) = map(int, sys.stdin.readline().split())
	(x, y, x1, y1, x2, y2) = map(int, sys.stdin.readline().split())
	res = 1
	hor = b - a
	ver = d - c
	if hor < x1 - x or hor > x2 - x:
		res = 0
	if ver < y1 - y or ver > y2 - y:
		res = 0
	if x1 == x2 and a + b > 0:
		res = 0
	if y1 == y2 and c + d > 0:
		res = 0
	print('Yes' if res else 'No')


t = int(input())

def possible(x, y, x1, y1, x2, y2, a, b, c, d):
	X = x - a + b
	Y = y - c + d
	if X > x:
		if not (x1 <= x and X <= x2):
			return False
	elif X < x:
		if not (x1 <= X and x <= x2):
			return False
	elif X == x:
		if not ((x1 + 1 <= x and x <= x2 or (x1 <= x and x <= x2 - 1)) and a != 0 or (x1 <= x <= x2 and a == 0)):
			return False
	if Y > y:
		if not (y1 <= y and Y <= y2):
			return False
	elif Y < y:
		if not (y1 <= Y and y <= y2):
			return False
	elif Y == y:
		if not ((y1 + 1 <= y and y <= y2 or (y1 <= y and y <= y2 - 1)) and c != 0 or (y1 <= y <= y2 and c == 0)):
			return False
	return True
for i in range(t):
	(a, b, c, d) = input().split()
	a = int(a)
	b = int(b)
	c = int(c)
	d = int(d)
	(x, y, x1, y1, x2, y2) = input().split()
	x = int(x)
	y = int(y)
	x1 = int(x1)
	y1 = int(y1)
	x2 = int(x2)
	y2 = int(y2)
	if possible(x, y, x1, y1, x2, y2, a, b, c, d):
		print('Yes')
	else:
		print('No')


t = int(input())
for i in range(t):
	(a, b, c, d) = map(int, input().split())
	(m, n, m1, n1, m2, n2) = map(int, input().split())
	m = m + (b - a)
	n = n + (d - c)
	if a + b > 0 and m1 == m2:
		print('No')
	elif c + d > 0 and n1 == n2:
		print('No')
	elif m1 <= m <= m2 and n1 <= n <= n2:
		print('Yes')
	else:
		print('No')


t = int(input())
for _ in range(t):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	yax = abs(c - d)
	ystar = y
	flag = 0
	if c > d:
		ystar -= yax
	elif d > c:
		ystar += yax
	z1 = y + 1
	z2 = y - 1
	if (z1 >= y1 or d == 0) and (z1 <= y2 or d == 0) or ((z2 >= y1 or c == 0) and (z2 <= y2 or c == 0)):
		if ystar >= y1 and ystar <= y2:
			pass
		else:
			flag = 1
	else:
		flag = 1
	xax = abs(a - b)
	xstar = x
	if a > b:
		xstar -= xax
	elif b > a:
		xstar += xax
	z1 = x + 1
	z2 = x - 1
	if (z1 >= x1 or b == 0) and (z1 <= x2 or b == 0) or ((z2 >= x1 or a == 0) and (z2 <= x2 or a == 0)):
		if xstar >= x1 and xstar <= x2:
			pass
		else:
			flag = 1
	else:
		flag = 1
	if flag != 1:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	x_ex = False
	y_ex = False
	diff_x = b - a
	diff_y = d - c
	if x + diff_x >= x1 and x + diff_x <= x2:
		x_ex = True
	if y + diff_y >= y1 and y + diff_y <= y2:
		y_ex = True
	if diff_x > 0:
		if x + 1 > x2:
			x_ex = False
	if diff_x < 0:
		if x - 1 < x1:
			x_ex = False
	if diff_x == 0 and a != 0:
		if x - 1 < x1 and x + 1 > x2:
			x_ex = False
	if diff_y > 0:
		if y + 1 > y2:
			y_ex = False
	if diff_y < 0:
		if y - 1 < y1:
			y_ex = False
	if diff_y == 0 and c != 0:
		if y - 1 < y1 and y + 1 > y2:
			y_ex = False
	if x_ex and y_ex:
		print('YES')
	else:
		print('NO')


from sys import stdin
input = stdin.readline
for _ in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	ab = a - b
	cd = c - d
	flag = 'Yes'
	if ab == 0 and x1 == x2 and (not a == b == 0):
		flag = 'No'
	if not x1 <= x - ab <= x2:
		flag = 'No'
	if cd == 0 and y1 == y2 and (not c == d == 0):
		flag = 'No'
	if not y1 <= y - cd <= y2:
		flag = 'No'
	print(flag)


for _ in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	FLAG = 0
	l = abs(x1 - x)
	r = abs(x2 - x)
	u = abs(y2 - y)
	db = abs(y1 - y)
	if (a > 0 or b > 0) and x == x1 and (x == x2):
		print('No')
	elif (c > 0 or db > 0) and y == y1 and (y == y2):
		print('No')
	elif l >= a - b and r >= b - a and (u >= d - c) and (db >= c - d):
		print('Yes')
	else:
		print('No')


import sys
a = int(input())
for j in range(a):
	l = list(map(int, input().split()))
	an = list(map(int, input().split()))
	if an[0] == an[2] == an[4]:
		if l[0] != 0 or l[1] != 0:
			print('No')
			continue
	if an[1] == an[3] == an[5]:
		if l[2] != 0 or l[3] != 0:
			print('No')
			continue
	val = abs(l[0] - l[1])
	if l[0] > l[1]:
		if an[0] - val < an[2]:
			print('No')
			continue
	elif an[0] + val > an[4]:
		print('No')
		continue
	val = abs(l[2] - l[3])
	if l[2] > l[3]:
		if an[1] - val < an[3]:
			print('No')
			continue
	elif an[1] + val > an[5]:
		print('No')
		continue
	print('Yes')


for _ in range(int(input())):
	(l, r, d, u) = map(int, input().split())
	(x1, y1, x2, y2, x3, y3) = map(int, input().split())
	f = 0
	if x1 - (l - r) < x2:
		f = 1
	if x1 + r - l > x3:
		f = 1
	if y1 + u - d < y2:
		f = 1
	if y1 + u - d > y3:
		f = 1
	if x2 == x3 and (l > 0 or r > 0):
		f = 1
	if y2 == y3 and (u > 0 or d > 0):
		f = 1
	if f == 0:
		print('YES')
	else:
		print('NO')


def debug_plot(x, x1, x2, final):
	plt.plot(x)
	plt.plot(x1)
	plt.plot(x2)
	plt.plot(final)
	plt.legned(['x', 'x_1', 'x_2', 'x_f'])
	plt.show()
nr_cases = int(input())
for i in range(nr_cases):
	(a, b, c, d) = map(int, input().split())
	coords = map(int, input().split())
	coords = list(coords)
	x = coords[0]
	y = coords[1]
	x1 = coords[2]
	y1 = coords[3]
	x2 = coords[4]
	y2 = coords[5]
	rem = d - c
	total_vert_space = y2 - y1
	turn_ok = True
	if rem == 0 and d != 0:
		turn_ok = total_vert_space != 0
	y_after = y + rem
	vertical_ok = y_after >= y1 and y_after <= y2 and turn_ok
	rem = b - a
	total_horiz_space = x2 - x1
	turn_ok = True
	if rem == 0 and b != 0:
		turn_ok = total_horiz_space != 0
	x_after = x + rem
	horiz_ok = x_after >= x1 and x_after <= x2 and turn_ok
	if vertical_ok and horiz_ok:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	(a, b, c, d) = list(map(int, input().split()))
	(x, y, x1, y1, x2, y2) = list(map(int, input().split()))
	u = b - a + x
	v = d - c + y
	flag = True
	if (u >= x1 and u <= x2) and (v >= y1 and v <= y2):
		if x - int(bool(a)) < x1 and x + int(bool(b)) > x2:
			flag = False
		if y - int(bool(c)) < y1 and y + int(bool(d)) > y2:
			flag = False
	else:
		flag = False
	if flag:
		print('Yes')
	else:
		print('No')


def main():
	t = int(input())
	for _ in range(t):
		(a, b, c, d) = map(int, input().split())
		(x, y, x1, y1, x2, y2) = map(int, input().split())
		hoz = b - a
		vert = d - c
		if hoz >= 0:
			hoz_test = hoz <= x2 - x
		else:
			hoz_test = -hoz <= x - x1
		if vert >= 0:
			vert_test = vert <= y2 - y
		else:
			vert_test = -vert <= y - y1
		if x == x1 == x2 and b + a > 0:
			hoz_test = False
		if y == y1 == y2 and c + d > 0:
			vert_test = False
		if hoz_test and vert_test:
			print('Yes')
		else:
			print('No')
main()


import sys
import math

def read_line():
	return sys.stdin.readline()[:-1]

def read_int():
	return int(sys.stdin.readline())

def read_int_line():
	return [int(v) for v in sys.stdin.readline().split()]
t = read_int()
for i in range(t):
	(a, b, c, d) = read_int_line()
	(x, y, x1, y1, x2, y2) = read_int_line()
	f = False
	if x1 == x2:
		f = True if a + b == 0 else False
	if x1 <= x - a + b <= x2 and x1 < x2:
		f = True
	f1 = False
	if y1 == y2:
		f1 = True if c + d == 0 else False
	if y1 <= y - c + d <= y2 and y1 < y2:
		f1 = True
	if f and f1:
		print('YES')
	else:
		print('NO')


def check(position, increase, decrease, lower, upper):
	valid = True
	if increase == decrease and increase == 0:
		valid = True
	elif increase > decrease:
		valid = valid and position + 1 <= upper
	elif increase == decrease:
		valid = valid and (lower <= position - 1 or position + 1 <= upper)
	else:
		valid = valid and lower <= position - 1
	return valid and lower <= position - decrease + increase <= upper
t = int(input())
for i in range(t):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	valid = check(x, b, a, x1, x2) and check(y, d, c, y1, y2)
	print('Yes' if valid else 'No')


n = int(input())
for i in range(n):
	(l, r, d, u) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	if x1 <= x - l + r <= x2 and y1 <= y - d + u <= y2 and (x1 != x2 or l == r == 0) and (y1 != y2 or d == u == 0):
		print('Yes')
	else:
		print('No')


T = int(input())
while T:
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	X = x - a + b
	Y = y - c + d
	fx1 = 1
	fx2 = 1
	if a != 0 and x - 1 < x1:
		fx1 = 0
	if b != 0 and x + 1 > x2:
		fx2 = 0
	fy1 = 1
	fy2 = 1
	if c != 0 and y - 1 < y1:
		fy1 = 0
	if d != 0 and y + 1 > y2:
		fy2 = 0
	if (fx1 == 1 or fx2 == 1) and (fy1 == 1 or fy2 == 1) and (x1 <= X and X <= x2) and (y1 <= Y and Y <= y2):
		print('YES')
	else:
		print('NO')
	T = T - 1


def solve(l, r, d, u, x, y, xl, yd, xr, yu):
	ans = 'Yes'
	if r - l > xr - x or l - r > x - xl:
		ans = 'No'
	if u - d > yu - y or d - u > y - yd:
		ans = 'No'
	if xl == xr and l + r > 0:
		ans = 'No'
	if yu == yd and u + d > 0:
		ans = 'No'
	return ans
t = int(input())
while t:
	(a, b, c, d) = map(int, input().split())
	(x, y, xl, yl, xr, yr) = list(map(int, input().split()))
	print(solve(a, b, c, d, x, y, xl, yl, xr, yr))
	t -= 1


import math as m
import string

def f1():
	T = int(input())
	while T != 0:
		T = T - 1
		ARRAY1 = [int(i) for i in input().split(' ')]
		ARRAY2 = [int(i) for i in input().split(' ')]
		(L, R, D, U) = (ARRAY1[0], ARRAY1[1], ARRAY1[2], ARRAY1[3])
		(x, y) = (ARRAY2[0], ARRAY2[1])
		(x1, y1) = (ARRAY2[2], ARRAY2[3])
		(x2, y2) = (ARRAY2[4], ARRAY2[5])
		Flag1 = False
		Flag2 = False
		if y1 <= y - D + U and y - D + U <= y2 and (y1 < y2 or D + U == 0):
			Flag1 = True
		if x1 <= x - L + R and x - L + R <= x2 and (x1 < x2 or L + R == 0):
			Flag2 = True
		if Flag1 == True and Flag2 == True:
			print('YES')
		else:
			print('NO')

def f2():
	T = int(input())
	while T != 0:
		T = T - 1
		N = int(input())
		ARRAY = [int(i) for i in input().split(' ')]
		ARR = [-1 for i in range(0, len(ARRAY))]
		CHECKER = [False] * N
		MAXELEMENT = max(ARRAY)
		Counter = len(ARRAY)
		Primes = GetPrimes(MAXELEMENT)
		Colour = 0
		Flag = False
		for i in range(2, len(Primes)):
			if Counter == 0:
				break
			if Primes[i] == True:
				Prime = i
				Flag = False
				Colour = Colour + 1
				for j in range(0, len(ARRAY)):
					if CHECKER[j] == True:
						continue
					if ARRAY[j] % Prime == 0:
						Flag = True
						ARR[j] = Colour
						CHECKER[j] = True
						Counter = Counter - 1
				if Flag == False:
					Colour = Colour - 1
		print(Colour)
		for i in range(0, len(ARR)):
			print(ARR[i], end=' ')
		print()

def GetPrimes(MAXELEMENT):
	ARRAY = [-1 for i in range(0, MAXELEMENT)]
	for i in range(0, MAXELEMENT):
		Number = i
		if Number == 1 or Number == 0:
			continue
		if ARRAY[i] == False:
			continue
		ARRAY[i] = True
		j = 2
		X = Number * j
		while X < MAXELEMENT:
			ARRAY[X] = False
			j = j + 1
			X = Number * j
	return ARRAY

def GCD(x, y):
	if x == 0:
		return y
	else:
		ans = GCD(y % x, x)
		return ans

def f3():
	T = int(input())
	ARRAY = [int(i) for i in input().split(' ')]
f1()


for _ in range(int(input())):
	(l, r, d, u) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	if x1 == x2 and (r > 0 or l > 0):
		print('NO')
	elif y1 == y2 and (d > 0 or u > 0):
		print('NO')
	elif r - l > x2 - x or l - r > x - x1:
		print('NO')
	elif u - d > y2 - y or d - u > y - y1:
		print('NO')
	else:
		print('YES')


def solve(ans):
	(l, r, d, u) = [int(x) for x in input().split()]
	(x, y, x1, y1, x2, y2) = [int(x) for x in input().split()]
	if x1 == x2 and (l != 0 or r != 0):
		ans.append('NO')
		return
	elif y1 == y2 and (u != 0 or d != 0):
		ans.append('NO')
		return
	net_effective_x = x - l + r
	net_effective_y = y - d + u
	if net_effective_x >= x1 and net_effective_x <= x2 and (net_effective_y >= y1) and (net_effective_y <= y2):
		ans.append('YES')
	else:
		ans.append('NO')
	return
n = int(input())
ans = []
for i in range(n):
	solve(ans)
for ele in ans:
	print(ele)


def f(A, B):
	x = B[0]
	y = B[1]
	if x == B[2] and x == B[4] and (A[0] != 0) and (A[1] != 0) or (y == B[3] and y == B[5] and (A[2] != 0) and (A[3] != 0)):
		return 'No'
	x = x + (A[1] - A[0])
	y = y + A[3] - A[2]
	if x >= B[2] and x <= B[4] and (y >= B[3]) and (y <= B[5]):
		return 'Yes'
	else:
		return 'No'
t = int(input())
while t > 0:
	A = list(map(int, input().split()))
	B = list(map(int, input().split()))
	print(f(A, B))
	t -= 1


count = int(input())
for test in range(count):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	dx = b - a
	dy = d - c
	if x1 == x2 and a + b > 0 or (y1 == y2 and c + d > 0):
		print('No')
		continue
	if x1 <= x + dx <= x2 and y1 <= y + dy <= y2:
		print('Yes')
	else:
		print('No')


import atexit
import io
import sys
_INPUT_LINES = sys.stdin.read().splitlines()
input = iter(_INPUT_LINES).__next__
_OUTPUT_BUFFER = io.StringIO()
sys.stdout = _OUTPUT_BUFFER

@atexit.register
def write():
	sys.__stdout__.write(_OUTPUT_BUFFER.getvalue())
testcases = int(input())
for case in range(testcases):
	(a, b, c, d) = [int(zax) for zax in input().split()]
	(x, y, x1, y1, x2, y2) = [int(zax) for zax in input().split()]
	best_x = b - a
	best_y = d - c
	if (x == x1 and x == x2) and (a > 0 or b > 0):
		print('NO')
	elif (y == y1 and y == y2) and (c > 0 or d > 0):
		print('NO')
	elif x1 <= best_x + x <= x2 and y1 <= best_y + y <= y2:
		print('YES')
	else:
		print('NO')


def calculate():
	numbers = input()
	numbers = numbers.split()
	x = -int(numbers[0]) + int(numbers[1])
	y = -int(numbers[2]) + int(numbers[3])
	limits = input()
	limits = limits.split()
	x0 = int(limits[0])
	y0 = int(limits[1])
	xleft = x0 - int(limits[2])
	ydown = y0 - int(limits[3])
	xright = int(limits[4]) - x0
	yup = int(limits[5]) - y0
	status = True
	if x < 0:
		if abs(x) > xleft:
			status = False
	elif abs(x) > xright:
		status = False
	if y < 0:
		if abs(y) > ydown:
			status = False
	elif abs(y) > yup:
		status = False
	if xleft == 0 and xright == 0 and (int(numbers[0]) > 0 or int(numbers[1]) > 0) or (yup == 0 and ydown == 0 and (int(numbers[2]) > 0 or int(numbers[3]) > 0)):
		status = False
	if status:
		print('Yes')
	else:
		print('No')
times = int(input())
for i in range(times):
	calculate()


t = int(input())
for _ in range(t):
	(a, b, c, d) = map(int, input().split(' '))
	left = max(a, b)
	right = max(c, d)
	(x, y, x1, y1, x2, y2) = map(int, input().split(' '))
	if a - b > 0:
		if abs(x - x1) >= a - b:
			if c - d > 0:
				if abs(y - y1) >= c - d:
					print('YES')
				else:
					print('NO')
			elif d - c > 0:
				if abs(y - y2) >= d - c:
					print('YES')
				else:
					print('NO')
			elif c != 0 and d != 0:
				if abs(y - y2) > 0 or abs(y - y1) > 0:
					print('YES')
				else:
					print('NO')
			else:
				print('YES')
		else:
			print('NO')
	elif b - a > 0:
		if abs(x - x2) >= b - a:
			if c - d > 0:
				if abs(y - y1) >= c - d:
					print('YES')
				else:
					print('NO')
			elif d - c > 0:
				if abs(y - y2) >= d - c:
					print('YES')
				else:
					print('NO')
			elif c != 0 and d != 0:
				if abs(y - y2) > 0 or abs(y - y1) > 0:
					print('YES')
				else:
					print('NO')
			else:
				print('YES')
		else:
			print('NO')
	elif a != 0 and b != 0:
		if abs(x - x1) > 0 or abs(x - x2) > 0:
			if c - d > 0:
				if abs(y - y1) >= c - d:
					print('YES')
				else:
					print('NO')
			elif d - c > 0:
				if abs(y - y2) >= d - c:
					print('YES')
				else:
					print('NO')
			elif c != 0 and d != 0:
				if abs(y - y2) > 0 or abs(y - y1) > 0:
					print('YES')
				else:
					print('NO')
			else:
				print('YES')
		else:
			print('NO')
	elif c - d > 0:
		if abs(y - y1) >= c - d:
			print('YES')
		else:
			print('NO')
	elif d - c > 0:
		if abs(y - y2) >= d - c:
			print('YES')
		else:
			print('NO')
	elif c != 0 and d != 0:
		if abs(y - y2) > 0 or abs(y - y1) > 0:
			print('YES')
		else:
			print('NO')
	else:
		print('YES')


queries = int(input())
for _ in range(queries):
	(left, right, down, up) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	destination = (x - left + right, y - down + up)
	if destination[0] >= x1 and destination[0] <= x2 and (destination[1] >= y1 and destination[1] <= y2) and (x2 > x1 or left + right == 0) and (y2 > y1 or up + down == 0):
		print('Yes')
	else:
		print('No')


import io
import os
from collections import Counter, defaultdict, deque

def solve(A, B, C, D, X, Y, X1, Y1, X2, Y2):
	XOk = X1 <= X + B - A <= X2
	if X1 == X2:
		XOk = A == 0 and B == 0 and (X == X1)
	YOk = Y1 <= Y + D - C <= Y2
	if Y1 == Y2:
		YOk = C == 0 and D == 0 and (Y == Y1)
	if XOk and YOk:
		return 'Yes'
	return 'No'
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
T = int(input())
for t in range(T):
	(A, B, C, D) = [int(x) for x in input().split()]
	(X, Y, X1, Y1, X2, Y2) = [int(x) for x in input().split()]
	ans = solve(A, B, C, D, X, Y, X1, Y1, X2, Y2)
	print(ans)


def is_path_exists(a, b, c, d, x, y, x1, y1, x2, y2):
	x1 -= x
	x2 -= x
	y1 -= y
	y2 -= y
	h_move = b - a
	v_move = d - c
	if x2 - x1 == 0 and (a or b):
		return 'No'
	if y2 - y1 == 0 and (c or d):
		return 'No'
	if x1 <= h_move <= x2 and y1 <= v_move <= y2:
		return 'Yes'
	else:
		return 'No'
n = int(input())
answers = []
for _ in range(n):
	(a, b, c, d) = list(map(int, input().split()))
	(x, y, x1, y1, x2, y2) = list(map(int, input().split()))
	answers.append(is_path_exists(a, b, c, d, x, y, x1, y1, x2, y2))
for answer in answers:
	print(answer)


class P1332A:

	def solve(self, a, b, c, d, x, y, x1, y1, x2, y2):
		if x1 == x2:
			if a != 0 or b != 0:
				return 'NO'
		if y1 == y2:
			if c != 0 or d != 0:
				return 'NO'
		if x1 <= x - a + b <= x2 and y1 <= y - c + d <= y2:
			return 'YES'
		else:
			return 'NO'
t = int(input())
for _ in range(t):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	print(P1332A().solve(a, b, c, d, x, y, x1, y1, x2, y2))


t = int(input())
for i in range(t):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	if x1 == x2:
		if a == b == 0:
			if y1 == y2:
				if c == d == 0:
					print('Yes')
				else:
					print('No')
			elif c == d:
				print('Yes')
			elif c > d:
				c -= d
				if y - c >= y1:
					print('Yes')
				else:
					print('No')
			else:
				d -= c
				if y + d <= y2:
					print('Yes')
				else:
					print('No')
		else:
			print('No')
	elif y1 == y2:
		if c == d == 0:
			if a == b:
				print('Yes')
			elif a > b:
				a -= b
				if x - a >= x1:
					print('Yes')
				else:
					print('No')
			else:
				b -= a
				if x + b <= x2:
					print('Yes')
				else:
					print('No')
		else:
			print('No')
	else:
		cnt = 0
		if c == d:
			cnt += 1
		elif c > d:
			c -= d
			if y - c >= y1:
				cnt += 1
		else:
			d -= c
			if y + d <= y2:
				cnt += 1
		if a == b:
			cnt += 1
		elif a > b:
			a -= b
			if x - a >= x1:
				cnt += 1
		else:
			b -= a
			if x + b <= x2:
				cnt += 1
		if cnt == 2:
			print('Yes')
		else:
			print('No')


t = int(input())
for i in range(t):
	(a, b, c, d) = map(int, input().split(' '))
	(x, y, x1, y1, x2, y2) = map(int, input().split(' '))
	x = x + b - a
	k = 1
	y = y + d - c
	if x1 == x2 and (a or b):
		print('No')
		k = 0
	elif y1 == y2 and (c or d):
		print('No')
		k = 0
	elif x1 <= x <= x2:
		if y1 <= y <= y2:
			print('YES')
			k = 0
	if k == 1:
		print('NO')


for _ in range(int(input())):
	(l, r, d, u) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	dx = r - l
	dy = u - d
	x += dx
	y += dy
	if min(r, l) >= 1 and x1 == x2:
		print('No')
		continue
	if min(u, d) >= 1 and y1 == y2:
		print('No')
		continue
	if x1 <= x and x <= x2 and (y1 <= y) and (y <= y2):
		print('Yes')
	else:
		print('No')


I = lambda : list(map(int, input().split()))
for _ in range(int(input())):
	(a, b, c, d) = I()
	p = a - b
	q = c - d
	(x, y, x1, y1, x2, y2) = I()
	(r, l, do, u) = (x2 - x, x - x1, y - y1, y2 - y)
	if (p <= l if p >= 0 else abs(p) <= r) and (q <= do if q >= 0 else abs(q) <= u):
		if (a != 0 or b != 0) and p == 0 and (l == r) and (r == 0) or ((c != 0 or d != 0) and q == 0 and (do == u) and (u == 0)):
			print('No')
		else:
			print('Yes')
	else:
		print('No')


import math
import collections
import functools
import sys
import os

def solve():
	[a, b, c, d] = list(map(int, input().split()))
	[x, y, x1, y1, x2, y2] = list(map(int, input().split()))
	if x1 == x2 and (a or b):
		print('NO')
		return
	if y1 == y2 and (d or c):
		print('NO')
		return
	if x >= x1 and x <= x2 and (y >= y1) and (y <= y2) and (x + b - a >= x1) and (x + b - a <= x2) and (y + d - c >= y1) and (y + d - c <= y2):
		print('YES')
		return
	else:
		print('NO')
		return

def main():
	T = 1
	T = int(input())
	while T:
		solve()
		T -= 1
main()


n = int(input())
while n > 0:
	(a, b, c, d) = [int(i) for i in input().split()]
	(x, y, x1, y1, x2, y2) = [int(i) for i in input().split()]
	if x2 == x1 and a + b > 0:
		print('No')
	elif (y1 == y2 and c + d) > 0:
		print('No')
	elif b - a + x in range(x1, x2 + 1):
		if d - c + y in range(y1, y2 + 1):
			print('Yes')
		else:
			print('No')
	else:
		print('No')
	n = n - 1


for i in range(int(input())):
	flag = 0
	fla = 0
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	row = a - b
	col = c - d
	w = y - col
	t = x - row
	if x1 <= t <= x2 and (x1 < x2 or a + b == 0):
		flag = 1
	if y1 <= w <= y2 and (y1 < y2 or c + d == 0):
		fla = 2
	if flag == 1 and fla == 2:
		print('YES')
	else:
		print('NO')


T = int(input())
for _ in range(T):
	(a, b, c, d) = list(map(int, input().split()))
	(x, y, x1, y1, x2, y2) = list(map(int, input().split()))
	ans = True
	d_x = b - a
	d_y = d - c
	ans = ans & (x + min(b, 1) <= x2 or x - min(a, 1) >= x1)
	ans = ans & (y + min(d, 1) <= y2 or y - min(c, 1) >= y1)
	ans = ans & (x + d_x >= x1) & (x + d_x <= x2) & (y + d_y >= y1) & (y + d_y <= y2)
	print('Yes' if ans else 'No')


test = int(input())
for _ in range(test):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	(finx, finy) = (b - a, d - c)
	flag = 1
	if finx + x >= x1 and finx + x <= x2 and (finy + y >= y1) and (finy + y <= y2):
		if x1 == x2 and (a != 0 or b != 0):
			flag = 0
		elif y1 == y2 and c * d:
			flag = 0
		else:
			flag = 1
	else:
		flag = 0
	if flag:
		print('Yes')
	else:
		print('No')
	if x == -3:
		print('hi')


def main():
	tc = int(input())
	res = []
	while tc:
		tc -= 1
		(left, right, down, up) = [int(vr) for vr in input().split(' ')]
		(posx, posy, x1, y1, x2, y2) = [int(vr) for vr in input().split(' ')]
		mright = right - left
		mup = up - down
		if x1 == x2 and (not (left == 0 and right == 0)):
			res.append('NO')
			continue
		if y1 == y2 and (not (up == 0 and down == 0)):
			res.append('NO')
			continue
		posx += mright
		posy += mup
		res.append('YES' if x1 <= posx <= x2 and y1 <= posy <= y2 else 'NO')
	for x in res:
		print(x)
main()


for _ in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	fg = 0
	if a > b:
		if x - x1 < a - b:
			fg = 1
	if a < b:
		if x2 - x < b - a:
			fg = 1
	if a == b and a > 0 and (x == x1 and x == x2):
		fg = 1
	if c == d and c > 0 and (y == y1 and y == y2):
		fg = 1
	if c > d:
		if y - y1 < c - d:
			fg = 1
	if c < d:
		if y2 - y < d - c:
			fg = 1
	if fg == 0:
		print('YES')
	else:
		print('NO')


t = int(input())
for tt in range(t):
	abcd = list(map(int, input().split(' ')))
	a = abcd[0]
	b = abcd[1]
	c = abcd[2]
	d = abcd[3]
	ll = list(map(int, input().split(' ')))
	x = ll[0]
	y = ll[1]
	x1 = ll[2]
	y1 = ll[3]
	x2 = ll[4]
	y2 = ll[5]
	if x1 == x2 and y1 == y2:
		if a == 0 and b == 0 and (c == 0) and (d == 0):
			print('YES')
		else:
			print('NO')
	elif x1 == x2 and y1 != y2:
		if a == 0 and b == 0:
			if c == d:
				print('YES')
			elif c > d:
				De = c - d
				if De <= y - y1:
					print('YES')
				else:
					print('NO')
			elif c < d:
				Ue = d - c
				if Ue <= y2 - y:
					print('YES')
				else:
					print('NO')
		else:
			print('NO')
	elif x1 != x2 and y1 == y2:
		if c == 0 and d == 0:
			if a == b:
				print('YES')
			elif a > b:
				Le = a - b
				if Le <= x - x1:
					print('YES')
				else:
					print('NO')
			elif a < b:
				Re = b - a
				if Re <= x2 - x:
					print('YES')
				else:
					print('NO')
		else:
			print('NO')
	elif x1 != x2 and y1 != y2:
		if a >= b and c >= d:
			Le = a - b
			De = c - d
			if Le <= x - x1 and De <= y - y1:
				print('YES')
			else:
				print('NO')
		elif a < b and c >= d:
			Re = b - a
			De = c - d
			if Re <= x2 - x and De <= y - y1:
				print('YES')
			else:
				print('NO')
		elif a >= b and c < d:
			Le = a - b
			Ue = d - c
			if Le <= x - x1 and Ue <= y2 - y:
				print('YES')
			else:
				print('NO')
		elif a < b and c < d:
			Re = b - a
			Ue = d - c
			if Re <= x2 - x and Ue <= y2 - y:
				print('YES')
			else:
				print('NO')
		else:
			print('TNP')


for _ in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	h = abs(a - b)
	v = abs(c - d)
	if a != 0 and x == x1 and (x == x2) or (b != 0 and x == x2 and (x == x1)) or (c != 0 and y == y1 and (y == y2)) or (d != 0 and y == y2 and (y == y1)):
		print('No')
	else:
		if a > b:
			x -= h
		else:
			x += h
		if c > d:
			y -= v
		else:
			y += v
		if x >= x1 and x <= x2 and (y >= y1) and (y <= y2):
			print('Yes')
		else:
			print('No')


def main():
	t = int(input())
	for i in range(t):
		abcd = input().split()
		a = int(abcd[0])
		b = int(abcd[1])
		c = int(abcd[2])
		d = int(abcd[3])
		xy = input().split()
		x = int(xy[0])
		y = int(xy[1])
		x1 = int(xy[2])
		y1 = int(xy[3])
		x2 = int(xy[4])
		y2 = int(xy[5])
		if x2 - x1 < 1 and a != 0 and (b != 0) or (y2 - y1 < 1 and c != 0 and (d != 0)):
			print('No')
			continue
		xIsOut = b - a + x
		yIsOut = d - c + y
		if xIsOut < x1 or xIsOut > x2:
			print('No')
			continue
		elif yIsOut < y1 or yIsOut > y2:
			print('No')
			continue
		else:
			print('Yes')
	return 0
main()


from sys import stdin

def arr_inp(n):
	return [int(x) for x in stdin.readline().split()]
ans = []
for i in range(int(input())):
	(dist, coor) = [arr_inp(1) for _ in range(2)]
	(v1, v2) = (dist[0] - dist[1], dist[2] - dist[3])
	coor[0] -= v1
	coor[1] -= v2
	cond = coor[0] >= coor[2] and coor[0] <= coor[4] and (coor[1] >= coor[3]) and (coor[1] <= coor[5])
	cond2 = coor[2] == coor[4] and (dist[0] or dist[1]) or (coor[3] == coor[5] and (dist[2] or dist[3]))
	ans.append('yes' if cond and (not cond2) else 'no')
print('\n'.join(ans))


for _ in range(0, int(input())):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	t = 1
	if a > b:
		t *= x - (a - b) >= x1
	elif b > a:
		t *= x + (b - a) <= x2
	elif a != 0:
		t = x1 != x2
	if c > d:
		t *= y - (c - d) >= y1
	elif d > c:
		t *= y + (d - c) <= y2
	elif c != 0:
		t *= y1 != y2
	ans = ['No', 'Yes']
	print(ans[t])


t = int(input())
for _ in range(0, t):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	diff_hor = x + b - a
	diff_ver = y + d - c
	if x1 == x2 and (a > 0 or b > 0) or (y1 == y2 and (c > 0 or d > 0)) or diff_hor < x1 or (diff_hor > x2) or (diff_ver < y1) or (diff_ver > y2):
		print('no')
	else:
		print('yes')


numwalk = int(input())

def compare_dist(min_x, min_y):
	if min_x > 0:
		if int(x2) - int(x) < abs(min_x):
			return 'NO'
	if min_x < 0:
		if int(x) - int(x1) < abs(min_x):
			return 'NO'
	if min_y > 0:
		if int(y2) - int(y) < abs(min_y):
			return 'NO'
	if min_y < 0:
		if int(y) - int(y1) < abs(min_y):
			return 'NO'
	if min_x == 0 and int(a) + int(b) != 0:
		if int(x) - int(x1) == 0 and int(x2) - int(x) == 0:
			return 'NO'
	if min_y == 0 and int(c) + int(d) != 0:
		if int(y) - int(y1) == 0 and int(y2) - int(y) == 0:
			return 'NO'
	return 'YES'
for i in range(numwalk):
	(a, b, c, d) = input().split(' ')
	(x, y, x1, y1, x2, y2) = input().split(' ')
	min_x = int(b) - int(a)
	min_y = int(d) - int(c)
	print(compare_dist(min_x, min_y))


for _ in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	if x == x1 == x2 and (not a == b == 0) or (y == y1 == y2 and (not c == d == 0)):
		print('No')
	else:
		flag = True
		left = abs(a - b)
		if max(a, b) == a:
			x -= left
		else:
			x += left
		up = abs(c - d)
		if max(c, d) == c:
			y -= up
		else:
			y += up
		if not x1 <= x <= x2:
			flag = False
		if not y1 <= y <= y2:
			flag = False
		print('Yes' if flag else 'No')


n = int(input())
ans = ''
for i in range(n):
	steps = list(map(int, input().split()))
	xy = list(map(int, input().split()))
	u = xy[0] - steps[0] + steps[1]
	v = xy[1] - steps[2] + steps[3]
	if xy[2] <= u and xy[4] >= u and (xy[3] <= v) and (xy[5] >= v) and (xy[2] <= xy[0] - min(steps[0], 1) or xy[4] >= xy[0] + min(steps[1], 1)) and (xy[3] <= xy[1] - min(steps[2], 1) or xy[5] >= xy[1] + min(steps[3], 1)):
		ans += 'Yes' + '\n'
	else:
		ans += 'No' + '\n'
print(ans)


import sys

def input():
	return sys.stdin.readline()[:-1]
t = int(input())
for _ in range(t):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	ok = True
	if a + b > 0 and x1 == x2:
		ok = False
	if c + d > 0 and y1 == y2:
		ok = False
	if a >= b:
		if x1 > x - (a - b):
			ok = False
	elif x2 < x + (b - a):
		ok = False
	if c >= d:
		if y1 > y - (c - d):
			ok = False
	elif y2 < y + (d - c):
		ok = False
	if ok:
		print('Yes')
	else:
		print('No')


t = int(input())
while t:
	t -= 1
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	ch = 0
	if a or b:
		nm = b - a
		if nm > 0:
			if x2 - x >= nm:
				ch += 1
		elif nm < 0:
			if x - x1 >= abs(nm):
				ch += 1
		elif x2 - x1 >= 1:
			ch += 1
	else:
		ch += 1
	if ch != 1:
		print('no')
		continue
	elif c or d:
		sr = d - c
		if sr > 0:
			if y2 - y >= sr:
				ch += 1
		elif sr < 0:
			if y - y1 >= abs(sr):
				ch += 1
		elif y2 - y1 >= 1:
			ch += 1
	else:
		ch += 1
	print('Yes' if ch == 2 else 'No')


def fname(a, b, c, d, x, y, x1, y1, x2, y2):
	if x1 == x2 and (a != 0 or b != 0):
		return 'No'
	if y1 == y2 and (c != 0 or d != 0):
		return 'No'
	if x1 <= x + b - a <= x2 and y1 <= y + d - c <= y2:
		return 'Yes'
	else:
		return 'No'
t = int(input())
for i in range(t):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	print(fname(a, b, c, d, x, y, x1, y1, x2, y2))


T = int(input())
for _ in range(T):
	(a, b, c, d) = map(int, input().split())
	(s_x, s_y, min_x, min_y, max_x, max_y) = map(int, input().split())
	diff_x = b - a
	diff_y = d - c
	if min_x <= s_x + diff_x <= max_x and min_y <= s_y + diff_y <= max_y and (a + b == 0 or max_x - min_x > 0) and (c + d == 0 or max_y - min_y > 0):
		print('Yes')
	else:
		print('No')


t = int(input())
for _ in range(t):
	(a, b, c, d) = list(map(int, input().split()))
	(x, y, x1, y1, x2, y2) = list(map(int, input().split()))
	if x1 == x2 and (a != 0 or b != 0):
		print('No')
	elif y1 == y2 and (c != 0 or d != 0):
		print('No')
	else:
		(hw, vw) = (a - b, c - d)
		fp = [x - hw, y - vw]
		if fp[0] < x1 or fp[0] > x2 or fp[1] < y1 or (fp[1] > y2):
			print('No')
		else:
			print('Yes')


t = int(input())
for _ in range(t):
	(a, b, c, d) = list(map(int, input().split()))
	(u, v, x1, y1, x2, y2) = list(map(int, input().split()))
	xd = b - a
	yd = d - c
	if x1 == x2 and (a > 0 or b > 0) or (y1 == y2 and (c > 0 or d > 0)):
		print('NO')
		continue
	if x1 <= xd + u <= x2 and y1 <= yd + v <= y2:
		print('YES')
	else:
		print('NO')


mov = []
pos = []
for _ in range(int(input())):
	mov = list(map(int, input().split()))
	pos = list(map(int, input().split()))
	if pos[2] <= pos[0] - mov[0] + mov[1] <= pos[4] and pos[3] <= pos[1] - mov[2] + mov[3] <= pos[5]:
		if pos[2] == pos[0] == pos[4] and mov[0] + mov[1] != 0 or (pos[3] == pos[1] == pos[5] and mov[2] + mov[3] != 0):
			print('NO')
		else:
			print('YES')
	else:
		print('NO')


ttt = int(input())
for qqq in range(ttt):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	mx = x - a + b
	my = y - c + d
	flag = x1 <= mx <= x2 and y1 <= my <= y2
	if x1 == x and x2 == x and (a + b > 0):
		flag = False
	if y1 == y and y2 == y and (c + d > 0):
		flag = False
	print('YES' if flag else 'NO')


from math import *
for i in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	if (x1 <= x - min(a, 1) <= x2 or x1 <= x + min(b, 1) <= x2) and x1 <= x + (b - a) <= x2:
		if (y1 <= y - min(c, 1) <= y2 or y1 <= y + min(d, 1) <= y2) and y1 <= y + (d - c) <= y2:
			print('Yes')
		else:
			print('No')
	else:
		print('No')


for _ in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	diff_x = abs(x1 - x2)
	diff_y = abs(y1 - y2)
	valid = True
	if (a != 0 or b != 0) and diff_x == 0 or diff_x < abs(a - b):
		valid = False
	elif (c != 0 or d != 0) and diff_y == 0 or diff_y < abs(c - d):
		valid = False
	if valid:
		if a > b and x1 > x - abs(a - b) or (a < b and x + abs(a - b) > x2):
			valid = False
		if c > d and y1 > y - abs(c - d) or (c < d and y + abs(c - d) > y2):
			valid = False
		if valid:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


t = int(input())
while t:
	t -= 1
	(l, r, d, u) = map(int, input().split())
	(x, y, xmin, ymin, xmax, ymax) = map(int, input().split())
	status = True
	fx = 0
	fy = 0
	if xmin == xmax:
		if l == 0 and r == 0:
			fx = 0
		else:
			fx = 1
	if ymin == ymax:
		if u == 0 and d == 0:
			fy = 0
		else:
			fy = 1
	difx = r - l
	dify = u - d
	dx = 0
	dy = 0
	if xmin <= x + difx <= xmax:
		dx = 0
	else:
		dx = 1
	if ymin <= y + dify <= ymax:
		dy = 0
	else:
		dy = 1
	if fx == 0 and fy == 0 and (dx == 0) and (dy == 0):
		print('Yes')
	else:
		print('No')


def main():
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	if x1 <= x + (b - a) <= x2 and y1 <= y + (d - c) <= y2:
		flag = True
		if a > 0 and b > 0 and (b - a == 0):
			if x2 - x1 < 1:
				flag = False
		if c > 0 and d > 0 and (d - c == 0):
			if y2 - y1 < 1:
				flag = False
		if flag:
			return 'YES'
	return 'NO'
t = int(input())
for _ in range(t):
	print(main())


import sys
for j in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	if a + b > 0 and x1 == x2:
		print('NO')
	elif c + d > 0 and y1 == y2:
		print('NO')
	elif x1 <= x + b - a <= x2 and y1 <= y + d - c <= y2:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	flg = 1
	if x1 == x2 and (a or b):
		flg = 0
	if y1 == y2 and (c or d):
		flg = 0
	if not (x1 <= x - a + b <= x2 and y1 <= y - c + d <= y2):
		flg = 0
	if flg:
		print('Yes')
	else:
		print('No')


t = int(input())
for test_case in range(1, t + 1):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	doable = True
	if x1 == x2:
		if a > 0 or b > 0:
			doable = False
	else:
		dx = b - a
		u = x + dx
		if u > x2 or u < x1:
			doable = False
	if y1 == y2:
		if c > 0 or d > 0:
			doable = False
	else:
		dy = d - c
		v = y + dy
		if v > y2 or v < y1:
			doable = False
	if doable:
		print('Yes')
	else:
		print('No')


t = int(input())
for i in range(t):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	xf = x - a + b
	yf = y - c + d
	if x1 == x2 and y1 == y2:
		print('NO')
		continue
	newx = abs(x2 - x1)
	newy = abs(y2 - y1)
	xval = 1
	yval = 1
	if x1 <= xf and xf <= x2 and (y1 <= yf) and (yf <= y2):
		if xf == x:
			if x1 == x2:
				if a == b and a == 0 and (b == 0):
					xval = 1
				else:
					xval = 0
			else:
				xval = 1
		if yf == y:
			if y1 == y2:
				if c == d and c == 0 and (d == 0):
					yval = 1
				else:
					yval = 0
			else:
				yval = 1
		if xval == 1 and yval == 1:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


res = []
t = int(input())
for t_curr in range(t):
	(a, b, c, d) = [int(x) for x in input().split()]
	(x, y, x1, y1, x2, y2) = [int(x) for x in input().split()]
	final_x = x - a + b
	final_y = y - c + d
	check = False
	if x1 <= final_x <= x2 and y1 <= final_y <= y2:
		check = True
	if a * b > 0 and x1 == x2:
		check = False
	if c * d > 0 and y1 == y2:
		check = False
	if check:
		res.append('Yes')
	else:
		res.append('No')
for item in res:
	print(item)


from sys import stdin, stdout

def f(a, b, c, d, x, y, x1, y1, x2, y2):
	c1 = 0
	c2 = 0
	if abs(x2 - x1) == 0 and (a != 0 or b != 0):
		stdout.write('NO\n')
		return
	if abs(y2 - y1) == 0 and (c != 0 or d != 0):
		stdout.write('NO\n')
		return
	if a > b:
		xm = x - (a - b)
		if xm - x1 >= 0:
			c1 = 1
	else:
		xm = x + b - a
		if x2 - xm >= 0:
			c1 = 1
	if c1:
		if d > c:
			ym = y + d - c
			if y2 - ym >= 0:
				c2 = 1
		else:
			ym = y - (c - d)
			if ym - y1 >= 0:
				c2 = 1
	if c2:
		stdout.write('YES\n')
	else:
		stdout.write('NO\n')
t = int(stdin.readline())
for i in range(t):
	(a, b, c, d) = list(map(int, stdin.readline().split()))
	(x, y, x1, y1, x2, y2) = list(map(int, stdin.readline().split()))
	f(a, b, c, d, x, y, x1, y1, x2, y2)


def Solve():
	for t in range(int(input())):
		e = True
		(a, b, c, d) = map(int, input().split())
		(x, y, x1, y1, x2, y2) = map(int, input().split())
		if x == x1 and x == x2 and (a > 0) or (y == y1 and y == y2 and (d > 0)):
			e = False
		nx = b - a
		ny = d - c
		x += nx
		y += ny
		if x1 <= x <= x2 and y1 <= y <= y2 and e:
			print('Yes')
		else:
			print('No')
Solve()


import sys
input = sys.stdin.readline

def input_list():
	return [int(x) for x in input().split()]

def a():
	(a, b, c, d) = input_list()
	(x, y, x1, y1, x2, y2) = input_list()
	result = x + b - a >= x1 and x + b - a <= x2 and (y + d - c >= y1) and (y + d - c <= y2) and (a == 0 and b == 0 or x1 < x2) and (c == 0 and d == 0 or y1 < y2)
	if result:
		print('Yes')
	else:
		print('No')

def main():
	t = int(input())
	for _ in range(t):
		a()
main()


t = int(input(''))
for _ in range(t):
	(a, b, c, d) = list(map(int, input('').split(' ')))
	(x, y, x1, y1, x2, y2) = list(map(int, input('').split(' ')))
	res = True
	finx = x + b - a
	finy = y + d - c
	if finx < x1 or finx > x2 or finy < y1 or (finy > y2):
		print('No')
		continue
	xspace = x1 - x == 0 and x2 - x == 0
	yspace = y1 - y == 0 and y2 - y == 0
	if (a or b) and xspace:
		print('No')
		continue
	if (c or d) and yspace:
		print('No')
		continue
	print('Yes')


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	(l, r, d, u) = list(map(int, input().split()))
	(x, y, x1, y1, x2, y2) = list(map(int, input().split()))
	xm = -l + r
	ym = -d + u
	if abs(l) > 0 or abs(r) > 0:
		if x - x1 == 0 and x2 - x == 0:
			print('No')
			continue
	if abs(d) > 0 or abs(u) > 0:
		if y - y1 == 0 and y2 - y == 0:
			print('No')
			continue
	fx = fy = 0
	if xm < 0:
		if x - x1 >= abs(xm):
			fx = 1
	elif x2 - x >= abs(xm):
		fx = 1
	if fx == 0:
		print('No')
		continue
	if ym < 0:
		if y - y1 >= abs(ym):
			fy = 1
	elif y2 - y >= abs(ym):
		fy = 1
	if fy == 0:
		print('No')
	else:
		print('Yes')


p = int(input())
for i in range(p):
	(l, m, n, o) = map(int, input().split())
	(x, y, x1, y1, x3, y3) = map(int, input().split())
	x += m - l
	y += o - n
	if l + m > 0 and x1 == x3:
		print('No')
	elif n + o > 0 and y1 == y3:
		print('No')
	elif x1 <= x <= x3 and y1 <= y <= y3:
		print('Yes')
	else:
		print('No')


t = int(input())
for test in range(t):
	moves = [int(x) for x in input().split()]
	(x, y, x1, y1, x2, y2) = [int(x) for x in input().split()]
	orgx = x
	orgy = y
	if moves[0] > moves[1]:
		if orgx - 1 >= x1 and orgx - 1 <= x2:
			x = x - moves[0]
			x = x + moves[1]
		else:
			print('No')
			continue
	elif moves[0] < moves[1]:
		if orgx + 1 >= x1 and orgx + 1 <= x2:
			x = x - moves[0]
			x = x + moves[1]
		else:
			print('No')
			continue
	elif orgx + 1 >= x1 and orgx + 1 <= x2 or (orgx - 1 >= x1 and orgx - 1 <= x2) or (moves[1] == 0 and moves[0] == 0):
		x = x - moves[0]
		x = x + moves[1]
	else:
		print('No')
		continue
	if moves[2] > moves[3]:
		if orgy - 1 >= y1 and orgy - 1 <= y2:
			y = y - moves[2]
			y = y + moves[3]
		else:
			print('No')
			continue
	elif moves[2] < moves[3]:
		if orgy + 1 >= y1 and orgy + 1 <= y2:
			y = y - moves[2]
			y = y + moves[3]
		else:
			print('No')
			continue
	elif orgy + 1 >= y1 and orgy + 1 <= y2 or (orgy - 1 >= y1 and orgy - 1 <= y2) or (moves[2] == 0 and moves[3] == 0):
		y = y - moves[2]
		y = y + moves[3]
	else:
		print('No')
		continue
	if ((orgx >= x1 and orgx <= x2) and (orgy >= y1 and orgy <= y2)) and ((x >= x1 and x <= x2) and (y >= y1 and y <= y2)):
		print('Yes')
	else:
		print('No')


def R():
	return map(int, input().split())

def I():
	return int(input())

def S():
	return str(input())

def L():
	return list(R())
from collections import Counter
import math
import sys
from itertools import permutations
import bisect
for _ in range(I()):
	(a, b, c, d) = R()
	(x, y, x1, y1, x2, y2) = R()
	cond1 = x1 <= x <= x2 and y1 <= y <= y2
	cond3 = True
	cond4 = True
	if x1 == x2:
		cond3 = a == b == 0
	if y1 == y2:
		cond4 = c == d == 0
	x3 = x + b - a
	y3 = y + d - c
	cond2 = x1 <= x3 <= x2 and y1 <= y3 <= y2
	print(['No', 'Yes'][cond1 and cond2 and cond3 and cond4])


t = int(input())
for i in range(t):
	(a, b, c, d) = list(map(int, input().split()))
	(x, y, x1, y1, x2, y2) = list(map(int, input().split()))
	x += b - a
	y += d - c
	u = a + b
	e = c + d
	if x >= x1 and x <= x2 and (y <= y2) and (y >= y1) and (not (u != 0 and x1 == x2)) and (not (e != 0 and y1 == y2)):
		print('Yes')
	else:
		print('No')


t = int(input())
for p in range(t):
	(a, b, c, d) = list(map(int, input().strip().split()))
	(x, y, x1, y1, x2, y2) = list(map(int, input().strip().split()))
	final_x = b - a + x
	final_y = d - c + y
	bool_one = True
	bool_two = True
	bool_three = True
	bool_four = True
	if a == b and a > 0:
		if x + 1 >= x1 and x + 1 <= x2 or (x - 1 >= x1 and x - 1 <= x2):
			bool_one = True
		else:
			bool_one = False
	if c == d and c > 0:
		if y + 1 >= y1 and y + 1 <= y2 or (y - 1 >= y1 and y - 1 <= y2):
			bool_two = True
		else:
			bool_two = False
	if final_x >= x1 and final_x <= x2 and (final_y >= y1) and (final_y <= y2) and bool_one and bool_two:
		print('Yes')
	else:
		print('No')


n = int(input())
for i in range(n):
	s = input().split(' ')
	a = int(s[0])
	b = int(s[1])
	c = int(s[2])
	d = int(s[3])
	s1 = input().split(' ')
	x = int(s1[0])
	y = int(s1[1])
	x1 = int(s1[2])
	y1 = int(s1[3])
	x2 = int(s1[4])
	y2 = int(s1[5])
	if x + (b - a) >= x1 and x + (b - a) <= x2 and (y + (d - c) >= y1) and (y + (d - c) <= y2):
		if x1 == x2 and (a != 0 and b != 0) or (y1 == y2 and (c != 0 and d != 0)):
			print('NO')
		else:
			print('YES')
	else:
		print('NO')


from __future__ import division, print_function
import os
import sys
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip

def main():
	t = int(input())
	for _ in range(t):
		(a, b, c, d) = map(int, input().split())
		(x, y, x1, y1, x2, y2) = map(int, input().split())
		x += b - a
		y += d - c
		if a + b > 0 and x1 == x2:
			print('No')
		elif c + d > 0 and y1 == y2:
			print('No')
		elif x1 <= x <= x2 and y1 <= y <= y2:
			print('Yes')
		else:
			print('No')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


for test in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	delta_x = a - b
	delta_y = c - d
	if delta_x == 0:
		if x2 - x > 0 or x - x1 > 0 or a == 0:
			flag_x = True
		else:
			flag_x = False
	elif delta_x > 0:
		if x - x1 >= delta_x:
			flag_x = True
		else:
			flag_x = False
	elif x2 - x >= abs(delta_x):
		flag_x = True
	else:
		flag_x = False
	if delta_y == 0:
		if y2 - y > 0 or y - y1 > 0 or c == 0:
			flag_y = True
		else:
			flag_y = False
	elif delta_y > 0:
		if y - y1 >= delta_y:
			flag_y = True
		else:
			flag_y = False
	elif y2 - y >= abs(delta_y):
		flag_y = True
	else:
		flag_y = False
	if flag_x and flag_y:
		print('Yes')
	else:
		print('No')


t = int(input())
ans = 0
ans1 = 0
for i in range(t):
	ans = 0
	ans1 = 0
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	if x1 == x and x2 == x and (a or b):
		print('No')
		continue
	if y1 == y and y2 == y and (c or d):
		print('No')
		continue
	if x1 < x or x2 > x:
		l = min(a, b)
		a = a - l
		b = b - l
	if y1 < y or y2 > y:
		l = min(c, d)
		c = c - l
		d = d - l
	ans = x - a + b
	ans1 = y - c + d
	if ans >= x1 and ans <= x2 and (ans1 >= y1) and (ans1 <= y2):
		print('Yes')
	else:
		print('No')


t = int(input())
for you in range(t):
	l = input().split()
	a = int(l[0])
	b = int(l[1])
	c = int(l[2])
	d = int(l[3])
	l = input().split()
	x = int(l[0])
	y = int(l[1])
	x1 = int(l[2])
	y1 = int(l[3])
	x2 = int(l[4])
	y2 = int(l[5])
	done = 1
	if x == x1 and x == x2 and (a > 0 or b > 0):
		done = 0
	if y == y1 and y == y2 and (c > 0 or d > 0):
		done = 0
	if b > a:
		if x + b - a > x2:
			done = 0
	elif x - (a - b) < x1:
		done = 0
	if d > c:
		if y + d - c > y2:
			done = 0
	elif y - (c - d) < y1:
		done = 0
	if done == 1:
		print('Yes')
	else:
		print('No')


ts = int(input())
for _ in range(ts):
	(a, b, c, d) = [int(i) for i in input().strip().split(' ')]
	(x, y, x1, y1, x2, y2) = [int(i) for i in input().strip().split(' ')]
	res = True
	(l, r) = [a, b]
	if a > 0 or b > 0:
		if x2 - x1 < 1:
			res = False
		elif l > r:
			if x - x1 < l - r:
				res = False
		elif x2 - x < r - l:
			res = False
	(a, b, x, x1, x2) = [c, d, y, y1, y2]
	(l, r) = [a, b]
	if a > 0 or b > 0:
		if x2 - x1 < 1:
			res = False
		elif l > r:
			if x - x1 < l - r:
				res = False
		elif x2 - x < r - l:
			res = False
	rs1 = 'YES' if res else 'NO'
	print(rs1)


def main():
	test = int(input())
	for t in range(test):
		l = [int(i) for i in input().split(' ')]
		a = l[0]
		b = l[1]
		c = l[2]
		d = l[3]
		l = [int(i) for i in input().split(' ')]
		x = l[0]
		y = l[1]
		x1 = l[2]
		y1 = l[3]
		x2 = l[4]
		y2 = l[5]
		flag = False
		if x2 - x1 == 0 and (a > 0 or b > 0):
			print('No')
		elif y2 - y1 == 0 and (c > 0 or d > 0):
			print('No')
		elif x == x1 and b == 0 and (a > 0) or (x == x2 and a == 0 and (b > 0)):
			print('No')
		elif y == y1 and d == 0 and (c > 0) or (y == y2 and c == 0 and (d > 0)):
			print('No')
		elif abs(a - b) <= x2 - x1 and abs(c - d) <= y2 - y1:
			if a > b:
				if x - x1 < a - b:
					print('No')
				else:
					flag = True
			elif b > a:
				if x2 - x < b - a:
					print('No')
				else:
					flag = True
			else:
				flag = True
		else:
			print('No')
		if flag:
			if c > d:
				if y - y1 < c - d:
					print('No')
				else:
					print('Yes')
			elif d > c:
				if y2 - y < d - c:
					print('No')
				else:
					print('Yes')
			else:
				print('Yes')
main()


t = int(input())
for test in range(t):
	(a, b, c, d) = [int(i) for i in input().split()]
	(x, y, x1, y1, x2, y2) = [int(i) for i in input().split()]
	doable = True
	if x - a + b <= x2 and x - a + b >= x1:
		doable = True
	else:
		print('NO')
		continue
	if y - c + d <= y2 and y - c + d >= y1:
		doable = True
	else:
		print('NO')
		continue
	if a > 0 and x == x1 and (x == x2):
		print('NO')
		continue
	if c > 0 and y == y1 and (y == y2):
		print('NO')
		continue
	print('YES')


from sys import stdin
input = lambda : stdin.readline()
from math import ceil, sqrt, gcd
for _ in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	flag = 'YES'
	t = b - a
	if x1 <= x + t <= x2:
		if x1 == x2 and (a > 0 or b > 0):
			flag = 'NO'
	else:
		flag = 'NO'
	t = d - c
	if y1 <= y + t <= y2:
		if y1 == y2 and (c > 0 or d > 0):
			flag = 'NO'
	else:
		flag = 'NO'
	print(flag)


import sys
sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep='\n')

def II():
	return int(sys.stdin.readline())

def MI():
	return map(int, sys.stdin.readline().split())

def LI():
	return list(map(int, sys.stdin.readline().split()))

def LLI(rows_number):
	return [LI() for _ in range(rows_number)]

def SI():
	return sys.stdin.readline()[:-1]

def main():
	for _ in range(II()):
		(a, b, c, d) = MI()
		(x, y, x1, y1, x2, y2) = MI()
		if x1 == x2 and min(a, b) > 0:
			print('No')
			continue
		if y1 == y2 and min(c, d) > 0:
			print('No')
			continue
		dx = b - a
		dy = d - c
		if x + dx < x1 or x + dx > x2 or y + dy < y1 or (y + dy > y2):
			print('No')
		else:
			print('Yes')
main()


t = int(input())
for _ in range(t):
	lis = list(map(int, input().split(' ')))
	(u, v, x1, y1, x2, y2) = tuple(map(int, input().split(' ')))
	mini = min(lis)
	lis2 = lis.copy()
	for i in range(len(lis)):
		lis[i] -= mini
	if (x1 < u or x2 > u) and (y1 < v or y2 > v):
		if u - lis[0] + lis[1] <= x2 and u - lis[0] + lis[1] >= x1 and (v - lis[2] + lis[3] <= y2) and (v - lis[2] + lis[3] >= y1):
			print('Yes')
		else:
			print('No')
	elif (x1 < u or x2 > u) and lis2[2] == 0 and (lis2[3] == 0):
		if u - lis[0] + lis[1] <= x2 and u - lis[0] + lis[1] >= x1 and (v - lis[2] + lis[3] <= y2) and (v - lis[2] + lis[3] >= y1):
			print('Yes')
		else:
			print('No')
	elif (y1 < v or y2 > v) and lis2[0] == 0 and (lis2[1] == 0):
		if u - lis[0] + lis[1] <= x2 and u - lis[0] + lis[1] >= x1 and (v - lis[2] + lis[3] <= y2) and (v - lis[2] + lis[3] >= y1):
			print('Yes')
		else:
			print('No')
	else:
		print('No')


import sys
I = lambda : int(input())
readline = lambda : sys.stdin.readline().strip('\n')
RM = readmap = lambda x=int: map(x, readline().split(' '))
for _ in range(I()):
	(a, b, c, d, x, y, x1, y1, x2, y2) = (*RM(), *RM())
	flag1 = x2 - x >= b - a and x - x1 >= a - b and (y2 - y >= d - c) and (y - y1 >= c - d)
	flag2 = (b == 0 and a == 0 or x2 - x1 > 0) and (c == 0 and d == 0 or y2 - y1 > 0)
	print(['NO', 'YES'][flag1 and flag2])


for _ in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	f = 1
	if y1 == y2 and (d != 0 or d != 0):
		print('NO')
		f += 2
		continue
	if x1 == x2 and (a != 0 or b != 0):
		print('NO')
		f += 2
		continue
	if -a + b + x >= x1 and -a + b + x <= x2 and (-c + d + y >= y1) and (-c + d + y <= y2):
		print('YES')
		f += 1
		l = [0 for i in range(10)]
		continue
	print('NO')


t = int(input())
r = []
for i in range(t):
	(b, a, d, c) = [int(aaa) for aaa in input().split()]
	(x, y, x1, y1, x2, y2) = [int(aaaa) for aaaa in input().split()]
	e1 = 0
	e2 = 0
	if a - b == 0:
		if a == 0 and b == 0:
			e1 = 1
		elif max(x - x1, x2 - x) > 0:
			e1 = 1
	elif a > b:
		if x2 - x >= a - b:
			e1 = 1
	elif x - x1 >= b - a:
		e1 = 1
	if c - d == 0:
		if c == 0 and d == 0:
			e2 = 1
		elif max(y - y1, y2 - y) > 0:
			e2 = 1
	elif c > d:
		if y2 - y >= c - d:
			e2 = 1
	elif y - y1 >= d - c:
		e2 = 1
	if e2 + e1 == 2:
		r.append('YES')
	else:
		r.append('NO')
for i in r:
	print(i)


t = int(input())
for _ in range(t):
	(a, b, c, d) = tuple(map(int, input().split()))
	(x, y, x1, y1, x2, y2) = tuple(map(int, input().split()))
	out = 'Yes'
	if x == x1 and x == x2 and (a + b > 0) or (x + b - a < x1 or x + b - a > x2) or (y == y1 and y == y2 and (c + d > 0)) or (y + d - c < y1 or y + d - c > y2):
		out = 'No'
	print(out)


t = int(input())
for _ in range(t):
	(l, r, d, u) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	left = x - x1
	right = x2 - x
	down = y - y1
	up = y2 - y
	s = True
	t = True
	if l > r:
		if l - r > left:
			s = False
	elif l < r:
		if r - l > right:
			s = False
	elif left < 1 and right < 1:
		if l >= 1:
			s = False
	if u > d:
		if u - d > up:
			t = False
	elif u < d:
		if d - u > down:
			t = False
	elif down < 1 and up < 1:
		if d >= 1:
			t = False
	if s and t:
		print('Yes')
	else:
		print('No')


t = int(input())
for k in range(t):
	(l, r, d, u) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	if x == x1 and x == x2 and (l > 0 or r > 0) or (y == y1 and y == y2 and (u > 0 or d > 0)):
		print('NO')
		continue
	x += r - l
	y += u - d
	if x >= x1 and x <= x2 and (y >= y1) and (y <= y2):
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	str1 = input()
	list1 = str1.split()
	a = int(list1[0])
	b = int(list1[1])
	c = int(list1[2])
	d = int(list1[3])
	str2 = input()
	list2 = str2.split()
	x = int(list2[0])
	y = int(list2[1])
	x1 = int(list2[2])
	y1 = int(list2[3])
	x2 = int(list2[4])
	y2 = int(list2[5])
	if x1 == x2 and (a > 0 or b > 0) or (y1 == y2 and (c > 0 or d > 0)):
		print('No\n')
	else:
		u = x - a + b
		v = y - c + d
		if x1 <= u <= x2 and y1 <= v <= y2:
			print('Yes\n')
		else:
			print('No\n')


from itertools import islice, count
n = int(input())
for _ in islice(count(1), n):
	(a, b, c, d) = [int(i) for i in input().split()]
	(x, y, x1, y1, x2, y2) = [int(i) for i in input().split()]
	if a + b > 0 and x1 == x2:
		print('NO')
	elif c + d > 0 and y1 == y2:
		print('NO')
	elif x1 <= x + b - a <= x2 and y1 <= y + d - c <= y2:
		print('YES')
	else:
		print('NO')


t = int(input())
for z in range(0, t):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	f = 0
	left = x - x1
	right = x2 - x
	up = y2 - y
	down = y - y1
	if left == 0 and right != 0 and (a > b):
		f = 1
	if left != 0 and right == 0 and (a < b):
		f = 1
	if left == 0 and right == 0:
		if a != 0 or b != 0:
			f = 1
	if up == 0 and down != 0 and (d > c):
		f = 1
	if up != 0 and down == 0 and (d < c):
		f = 1
	if up == 0 and down == 0:
		if c != 0 or d != 0:
			f = 1
	if a > b:
		a = a - b
		b = 0
		xf = x - a
	else:
		b = b - a
		a = 0
		xf = x + b
	if c > d:
		c = c - d
		d = 0
		yf = y - c
	else:
		d = d - c
		c = 0
		yf = y + d
	if x1 <= xf and xf <= x2 and (y1 <= yf) and (yf <= y2) and (f == 0):
		print('Yes')
	else:
		print('No')


def to_list(s):
	return list(map(lambda x: int(x), s.split(' ')))

def solve(a, b, c, d, x, y, x1, y1, x2, y2):
	residue = [a, b, c, d]
	if (x1 == x2) & (a + b != 0) | (y1 == y2) & (c + d != 0):
		return 'No'
	residue[0] -= min(a, b)
	residue[1] -= min(a, b)
	residue[2] -= min(c, d)
	residue[3] -= min(c, d)
	if (x - x1 < residue[0]) | (x2 - x < residue[1]) | (y - y1 < residue[2]) | (y2 - y < residue[3]):
		return 'No'
	else:
		return 'Yes'
answers = []
t = int(input())
for i in range(t):
	(a, b, c, d) = to_list(input())
	(x, y, x1, y1, x2, y2) = to_list(input())
	answers.append(solve(a, b, c, d, x, y, x1, y1, x2, y2))
print('\n'.join(answers))


import sys

def set_debug(debug_mode=False):
	if debug_mode:
		fin = open('input.txt', 'r')
		fout = open('output.txt', 'w')
		sys.stdin = fin
		sys.stdout = fout
t = int(input())
for _ in range(t):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	if (x1 <= x + b - a <= x2 and y1 <= y + d - c <= y2) and (not (x1 == x2 and a + b > 0 or (y1 == y2 and d + c > 0))):
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	(xn, yn) = (x - a + b, y - c + d)
	print('YNEOS'[1 - (x1 <= xn and xn <= x2 and (y1 <= yn) and (yn <= y2) and (x2 > x1 or a + b == 0) and (y2 > y1 or c + d == 0))::2])


from sys import stdin

def solver(x, x1, x2, a, b):
	if not x1 <= x - a + b <= x2:
		return False
	if x - x1 == 0 and a - b > 0:
		return False
	if x2 - x == 0 and b - a > 0:
		return False
	if b > a:
		if x2 == x:
			return False
	if a > b:
		if x1 == x:
			return False
	if b == a:
		if b != 0:
			if not (x1 < x or x2 > x):
				return False
	return True
t = int(input())
for _ in range(t):
	(a, b, c, d) = map(int, stdin.readline().split())
	(x, y, x1, y1, x2, y2) = map(int, stdin.readline().split())
	if solver(x, x1, x2, a, b) and solver(y, y1, y2, c, d):
		print('YES')
	else:
		print('NO')


testCases = int(input())
for i1 in range(testCases):
	parameters = list(map(int, input().split()))
	coordinates = list(map(int, input().split()))
	xBound = False
	yBound = False
	if parameters[1] == parameters[0]:
		if parameters[0] == 0:
			if coordinates[2] <= coordinates[0] <= coordinates[4]:
				xBound = True
		elif coordinates[2] <= coordinates[0] - 1 or coordinates[0] + 1 <= coordinates[4]:
			xBound = True
	elif coordinates[2] <= coordinates[0] + parameters[1] - parameters[0] <= coordinates[4]:
		xBound = True
	if parameters[3] == parameters[2]:
		if parameters[2] == 0:
			if coordinates[3] <= coordinates[1] <= coordinates[5]:
				yBound = True
		elif coordinates[3] <= coordinates[1] - 1 or coordinates[1] + 1 <= coordinates[5]:
			yBound = True
	elif coordinates[3] <= coordinates[1] + parameters[3] - parameters[2] <= coordinates[5]:
		yBound = True
	if xBound and yBound:
		print('Yes')
	else:
		print('No')


n = int(input())
for i in range(n):
	(l, r, d, u) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	h = r - l
	v = u - d
	if x == x1 and x == x2 and (r > 0) and (l > 0) or (y == y1 and y == y2 and (d > 0) and (u > 0)):
		print('NO')
	elif x2 - x >= h >= x1 - x and y2 - y >= v >= y1 - y:
		print('YES')
	else:
		print('NO')


cases = int(input())
for _ in range(cases):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	no = False
	if x2 - x1 == 0 and (a or b):
		no = True
	elif y2 - y1 == 0 and (c or d):
		no = True
	a -= b
	c -= d
	x -= a
	y -= c
	if x >= x1 and x <= x2 and (y >= y1) and (y <= y2) and (not no):
		print('Yes')
	else:
		print('No')


import sys

def answer(a, b, c, d, x, y, x1, y1, x2, y2):
	h = b - a
	v = d - c
	if x2 - x1 == 0 and (a != 0 or b != 0):
		return 'NO'
	if y2 - y1 == 0 and (c != 0 or c != 0):
		return 'NO'
	if x + h < x1 or x + h > x2:
		return 'NO'
	if y + v < y1 or y + v > y2:
		return 'NO'
	return 'YES'

def main():
	t = int(input())
	while t:
		(a, b, c, d) = [int(i) for i in sys.stdin.readline().split()]
		(x, y, x1, y1, x2, y2) = [int(i) for i in sys.stdin.readline().split()]
		print(answer(a, b, c, d, x, y, x1, y1, x2, y2))
		t -= 1
	return
main()


tests = int(input())
for _ in range(tests):
	moves = list(map(int, input().split()))
	xy = list(map(int, input().split()))
	(lr, ud) = (moves[1] - moves[0], moves[3] - moves[2])
	(x1, y1, x2, y2) = (abs(xy[2] - xy[0]), abs(xy[3] - xy[1]), abs(xy[4] - xy[0]), abs(xy[5] - xy[1]))
	if x1 == 0 and x2 == 0 and (moves[0] > 0 or moves[1] > 0):
		print('No')
	elif y1 == 0 and y2 == 0 and (moves[2] > 0 or moves[3] > 0):
		print('No')
	elif any([lr <= 0 and x1 < abs(lr), lr >= 0 and x2 < lr, ud <= 0 and y1 < abs(ud), ud >= 0 and y2 < ud]):
		print('No')
	else:
		print('Yes')


z = int(input())
while z:
	(a, b, c, d) = map(int, input().rstrip().split(' '))
	(x, y, x1, y1, x2, y2) = map(int, input().rstrip().split(' '))
	count = 0
	if x + b - a in range(min(x1, x2), max(x1, x2) + 1):
		count += 1
	if y + d - c in range(min(y1, y2), max(y1, y2) + 1):
		count += 1
	if x1 == x2 and b:
		count = 0
	if x1 == x2 and a:
		count = 0
	if y1 == y2 and c:
		count = 0
	if y1 == y2 and d:
		count = 0
	if count == 2:
		print('YES')
	else:
		print('NO')
	z -= 1


for _ in range(int(input())):
	(l, r, d, u) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	f = 0
	diff1 = r - l + x
	diff2 = u - d + y
	if l + r > 0 and x1 == x2:
		f = 1
	elif d + u > 0 and y1 == y2:
		f = 1
	elif x1 <= diff1 <= x2 and y1 <= diff2 <= y2:
		pass
	else:
		f = 1
	if f:
		print('No')
	else:
		print('Yes')


for _ in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	h = b - a
	v = d - c
	x0 = min(x1, x2)
	x9 = max(x1, x2)
	y0 = min(y1, y2)
	y9 = max(y1, y2)
	if h:
		if x0 <= x + h <= x9:
			flag1 = True
		else:
			print('NO')
			continue
	elif a and b:
		if x0 <= x + 1 <= x9 or x0 <= x - 1 <= x9:
			flag1 = True
		else:
			print('NO')
			continue
	else:
		flag1 = True
	if v:
		if y0 <= y + v <= y9 and flag1:
			print('YES')
		else:
			print('NO')
			continue
	elif c and d and flag1:
		if y0 <= y + 1 <= y9 or y0 <= y - 1 <= y9:
			print('YES')
		else:
			print('NO')
			continue
	else:
		print('YES')


t = int(input())
for case_num in range(t):
	(a, b, c, d) = map(int, input().split(' '))
	(x, y, x1, y1, x2, y2) = map(int, input().split(' '))
	ok = True
	if a > b:
		delta = a - b
		if x - x1 < delta:
			ok = False
	elif a == b and a > 0:
		if x == x1 and x == x2:
			ok = False
	else:
		delta = b - a
		if x2 - x < delta:
			ok = False
	if c > d:
		delta = c - d
		if y - y1 < delta:
			ok = False
	elif c == d and c > 0:
		if y == y1 and y == y2:
			ok = False
	else:
		delta = d - c
		if y2 - y < delta:
			ok = False
	print('Yes' if ok else 'No')


from sys import stdin
input = stdin.readline
import math
for i in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	flag1 = a != 0 or b != 0
	flag2 = c != 0 or d != 0
	(a, c) = (a - b, c - d)
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	(xx, yy) = (x - a, y - c)
	if x1 == x and x2 == x and flag1 or (y1 == y and y2 == y and flag2):
		print('No')
	elif not (x1 <= xx and xx <= x2 and (y1 <= yy) and (yy <= y2)):
		print('No')
	else:
		print('Yes')


from collections import defaultdict
import bisect
import sys
input = sys.stdin.readline

def solve(aa, xx):
	(a, b, c, d) = aa
	(x, y, x1, y1, x2, y2) = xx
	hstep = b - a
	vstep = d - c
	leftspan = x - x1
	rightspan = x2 - x
	upspan = y2 - y
	downspan = y - y1
	hflag = False
	vflag = False
	if hstep >= 0 and rightspan >= hstep or (hstep <= 0 and leftspan >= -hstep):
		hflag = True
	if vstep >= 0 and upspan >= vstep or (vstep <= 0 and downspan >= -vstep):
		vflag = True
	if hflag and hstep == 0 and (a > 0) and (leftspan == 0) and (rightspan == 0):
		hflag = False
	if vflag and vstep == 0 and (c > 0) and (upspan == 0) and (downspan == 0):
		vflag = False
	if hflag and vflag:
		print('Yes')
	else:
		print('No')

def main():
	t = int(input())
	for i in range(t):
		aa = list(map(int, input().split()))
		xx = list(map(int, input().split()))
		solve(aa, xx)
main()


for zxc in range(int(input())):
	zxcv = 0
	(a, b, c, d) = input().split(' ')
	(x, y, x1, y1, x2, y2) = input().split(' ')
	(a, b, c, d, x, y, x1, x2, y2, y1) = (int(a), int(b), int(c), int(d), int(x), int(y), int(x1), int(x2), int(y2), int(y1))
	if x1 > x + b - a or x + b - a > x2:
		zxcv += 1
	if y1 > y + d - c or y + d - c > y2:
		zxcv += 1
	if x1 - x2 == 0 and (a > 0 or b > 0) or (y2 - y1 == 0 and (c > 0 or d > 0)):
		zxcv += 1
	if y1 > y or y > y2 or x1 > x or (x > x2):
		zxcv += 1
	if zxcv > 0:
		print('No')
	else:
		print('Yes')


import os, sys, bisect, copy
from collections import defaultdict, Counter, deque
from functools import lru_cache
if os.path.exists('in.txt'):
	sys.stdin = open('in.txt', 'r')
if os.path.exists('out.txt'):
	sys.stdout = open('out.txt', 'w')

def input():
	return sys.stdin.readline()

def mapi(arg=0):
	return map(int if arg == 0 else str, input().split())
for _ in range(int(input())):
	(a, b, c, d) = mapi()
	(x, y, x1, y1, x2, y2) = mapi()
	x0 = x + b - a
	y0 = y + d - c
	flag = 1
	if x0 == x1 and x0 == x2 and (a != 0 or b != 0) or (y0 == y1 and y0 == y2 and (c != 0 or d != 0)):
		flag = 0
	if not (x0 >= x1 and x0 <= x2):
		flag = 0
	if y0 < y1 or y0 > y2:
		flag = 0
	if flag:
		print('Yes')
	else:
		print('No')


t = int(input())
for _ in range(t):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	dx = x2 - x1
	dy = y2 - y1
	if dx == 0:
		if a != 0 or b != 0:
			print('no')
			continue
	if dy == 0:
		if c != 0 or d != 0:
			print('no')
			continue
	if x1 <= x - a + b <= x2 and y1 <= y - c + d <= y2:
		print('yes')
	else:
		print('no')


t = int(input())

def solve():
	(left, right, down, up) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	if x1 == x == x2 and (left is not 0 or right is not 0):
		return False
	if y1 == y == y2 and (down is not 0 or up is not 0):
		return False
	if x1 <= x - left + right <= x2 and y1 <= y - down + up <= y2:
		return True
	return False
for _ in range(t):
	print('YES' if solve() else 'NO')


t = int(input())
for _ in range(t):
	(a, b, c, d) = [int(x) for x in input().split()]
	(x, y, x1, y1, x2, y2) = [int(x) for x in input().split()]
	minRight = x1 - x
	maxRight = x2 - x
	minUp = y1 - y
	maxUp = y2 - y
	finalRight = b - a
	finalUp = d - c
	if x1 > x or x2 < x or y1 > y or (y2 < y):
		print('No')
		continue
	if minRight == maxRight and (a != 0 or b != 0):
		print('No')
		continue
	if minUp == maxUp and (c != 0 or d != 0):
		print('No')
		continue
	if minRight <= finalRight <= maxRight and minUp <= finalUp <= maxUp:
		print('Yes')
	else:
		print('No')


import sys
input = sys.stdin.readline
T = int(input())
for _ in range(T):
	(L, R, D, U) = map(int, input().split())
	(X, Y, X1, Y1, X2, Y2) = map(int, input().split())
	X1 -= X
	X2 -= X
	Y1 -= Y
	Y2 -= Y
	if R == L and R >= 1 and (X2 - X1 == 0):
		print('No')
		continue
	elif not X1 <= R - L <= X2:
		print('No')
		continue
	elif U == D and U >= 1 and (Y2 - Y1 == 0):
		print('No')
		continue
	elif not Y1 <= U - D <= Y2:
		print('No')
		continue
	else:
		print('Yes')


t = int(input())

def func():
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	horizontal = a * -1 + b
	vertical = c * -1 + d
	horizontal = horizontal
	vertical = vertical
	abs_x = x2 - x1
	abs_y = y2 - y1
	if a != 0 and b != 0:
		if abs_x < 1:
			return False
	if c != 0 and d != 0:
		if abs_y < 1:
			return False
	if abs_x >= horizontal:
		if abs_y >= vertical:
			horizontal = x + horizontal
			vertical = y + vertical
			if horizontal <= x2 and horizontal >= x1:
				if vertical <= y2 and vertical >= y1:
					return True
				else:
					return False
			else:
				return False
			return True
		else:
			return False
	else:
		return False
while t:
	x = func()
	if x == True:
		print('YES')
	else:
		print('NO')
	t -= 1


import sys
import math
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	if (x + b - a >= x1 and x + b - a <= x2 and (y1 <= y - c + d) and (y - c + d <= y2)) and (x - min(a, 1) >= x1 or x + min(b, 1) <= x2) and (y - min(c, 1) >= y1 or y + min(d, 1) <= y2):
		print('YES')
	else:
		print('NO')


t = int(input())
for tc in range(t):
	(a, b, c, d) = map(int, input().split(' '))
	(x, y, x1, y1, x2, y2) = map(int, input().split(' '))
	endx = x + b - a
	endy = y + d - c
	canWalkX = abs(x2 - x1)
	canWalkY = abs(y2 - y1)
	possibleX = False
	possibleY = False
	if canWalkX and endx <= x2 and (endx >= x1):
		possibleX = True
	elif not canWalkX and b == 0 and (a == 0):
		possibleX = True
	if canWalkY and endy <= y2 and (endy >= y1):
		possibleY = True
	elif not canWalkY and c == 0 and (d == 0):
		possibleY = True
	if possibleY and possibleX:
		print('YES')
	else:
		print('NO')


import collections

class Solution:

	def solve(self, a, b, c, d, x, y, x1, y1, x2, y2):
		horizontalMovement = a - b
		verticalMovement = c - d
		if horizontalMovement == 0 and a != 0 and (b != 0) and (x2 - x1 < 1):
			return False
		if verticalMovement == 0 and c != 0 and (d != 0) and (y2 - y1 < 1):
			return False
		if horizontalMovement > 0 and x - x1 < horizontalMovement:
			return False
		elif horizontalMovement < 0 and x2 - x < abs(horizontalMovement):
			return False
		if verticalMovement > 0 and y - y1 < verticalMovement:
			return False
		elif verticalMovement < 0 and y2 - y < abs(verticalMovement):
			return False
		return True
sol = Solution()
t = int(input().strip())
for i in range(t):
	[a, b, c, d] = list(map(int, input().strip().split()))
	[x, y, x1, y1, x2, y2] = list(map(int, input().strip().split()))
	print('Yes' if sol.solve(a, b, c, d, x, y, x1, y1, x2, y2) else 'No')


def check(a, b, x, x1, x2) -> bool:
	if a == b:
		return x > x1 or x < x2 or a == 0
	elif a > b:
		return a - b <= x - x1
	else:
		return b - a <= x2 - x
for __ in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	print('YES' if check(a, b, x, x1, x2) and check(c, d, y, y1, y2) else 'NO')


import sys
import os
from io import BytesIO, IOBase

def cel(n, k):
	return n // k + (n % k != 0)

def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return list(map(int, input().split()))

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)

def prr(a, sep=' '):
	print(sep.join(map(str, a)))

def dd():
	return defaultdict(int)

def ddl():
	return defaultdict(list)

def ddd():
	return defaultdict(defaultdict(int))
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
from collections import defaultdict
for _ in range(ii()):
	(a, b, c, d) = mi()
	(x, y, x1, y1, x2, y2) = mi()
	if x1 == x2 and (a > 0 or b > 0):
		print('NO')
	elif y1 == y2 and (c > 0 or d > 0):
		print('NO')
	elif x1 <= x + b - a <= x2 and y1 <= y + d - c <= y2:
		print('YES')
	else:
		print('NO')


def solve():
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	if x1 == x2 and (a != 0 or b != 0):
		print('No')
		return
	if y1 == y2 and (c != 0 or d != 0):
		print('No')
		return
	finalx = b - a + x
	finaly = d - c + y
	if x1 <= finalx <= x2 and y1 <= finaly <= y2:
		print('Yes')
	else:
		print('No')
for _ in range(int(input())):
	solve()


for uu in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	(u, v) = (x, y)
	if x1 == x2 and (a != 0 and b != 0) or (y1 == y2 and (c != 0 and d != 0)):
		print('No')
	else:
		x = x - a + b
		y = y - c + d
		if (x >= x1 and x <= x2) and (y >= y1 and y <= y2):
			print('Yes')
		else:
			print('No')


for _ in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	r = x2 - x
	l = x - x1
	u = y2 - y
	D = y - y1
	ans_x = max(a, b) - min(a, b)
	flag = 0
	if a > b:
		if ans_x > l:
			print('NO')
			flag = 1
	elif ans_x > r:
		print('NO')
		flag = 1
	ans_y = max(c, d) - min(c, d)
	if flag == 0 and c > d:
		if ans_y > D:
			print('NO')
			flag = 1
	elif flag == 0:
		if ans_y > u:
			print('NO')
			flag = 1
	if flag == 0 and (x1 != x2 or a == 0) and (y1 != y2 or c == 0):
		print('YES')
	elif flag == 0:
		print('NO')


from math import factorial
from collections import Counter, defaultdict
from heapq import heapify, heappop, heappush
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def RL():
	return map(int, sys.stdin.readline().rstrip().split())

def N():
	return int(input())

def comb(n, m):
	return factorial(n) / (factorial(m) * factorial(n - m)) if n >= m else 0

def perm(n, m):
	return factorial(n) // factorial(n - m) if n >= m else 0

def mdis(x1, y1, x2, y2):
	return abs(x1 - x2) + abs(y1 - y2)
mod = 1000000007
INF = float('inf')

def main():
	for _ in range(N()):
		(a, b, c, d) = RL()
		(x, y, x1, y1, x2, y2) = RL()
		if x1 == x2 and (a != 0 or b != 0) or (y1 == y2 and (c != 0 or d != 0)):
			print('No')
			continue
		(m1, m2) = (min(a, b), min(c, d))
		a -= m1
		b -= m1
		c -= m2
		d -= m2
		if x - a < min(x1, x2) or x + b > max(x1, x2) or y + d > max(y1, y2) or (y - c < min(y1, y2)):
			print('No')
		else:
			print('Yes')
main()


from sys import stdin
I = stdin.readline
for _ in range(int(I())):
	(a, b, c, d) = map(int, I().split())
	(x, y, x1, y1, x2, y2) = map(int, I().split())
	cnt = 0
	if x1 - x2 == 0 and (a != 0 or b != 0):
		print('NO')
		continue
	elif y1 - y2 == 0 and (c != 0 or d != 0):
		print('NO')
		continue
	horizontal = b - a
	vertical = d - c
	if x1 <= x + horizontal <= x2 and y1 <= y + vertical <= y2:
		print('YES')
	else:
		print('NO')


def check(x1, x, x2, l, r):
	flag = 0
	if r > l:
		if x2 - x < r - l:
			flag = 1
	elif r == l:
		if x2 - x1 == 0 and l != 0:
			flag = 1
	elif x - x1 < l - r:
		flag = 1
	return flag
t = int(input())
for _ in range(t):
	(l, r, d, u) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	flag = 1
	if check(x1, x, x2, l, r) or check(y1, y, y2, d, u):
		print('NO')
	else:
		print('YES')


import sys
t = int(input())
inp = [line.strip().split() for line in reversed(sys.stdin.readlines())]
ans = []
while t:
	(a, b, c, d) = map(int, inp[-1])
	(x, y, x1, y1, x2, y2) = map(int, inp[-2])
	if x == x1 == x2 and (a != 0 or b != 0):
		ans.append('NO')
	elif y == y1 == y2 and (c != 0 or d != 0):
		ans.append('NO')
	elif x1 <= x - a + b <= x2 and y1 <= y - c + d <= y2:
		ans.append('YES')
	else:
		ans.append('NO')
	inp.pop()
	inp.pop()
	t -= 1
print(*ans, sep='\n')


import sys
from functools import lru_cache
from heapq import merge, heapify, heappop, heappush
from math import ceil, floor, gcd, fabs, factorial, fmod, sqrt, inf
from collections import defaultdict as dd, deque, Counter as c
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
mod = pow(10, 9) + 7
mod2 = 998244353

def data():
	return sys.stdin.readline().strip()

def out(var):
	sys.stdout.write(str(var))

def outln(var):
	sys.stdout.write(str(var) + '\n')

def l():
	return list(sp())

def sl():
	return list(ssp())

def sp():
	return map(int, data().split())

def ssp():
	return map(str, data().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(n, val) for j in range(m)]
for _ in range(int(data())):
	(a, b, c, d) = sp()
	(x, y, x1, y1, x2, y2) = sp()
	if not min(x1, x2) <= x <= max(x1, x2) or not min(y1, y2) <= y <= max(y1, y2):
		outln('NO')
		continue
	x += b - a
	y += d - c
	if x1 - x2 == 0 and (a > 0 or b > 0):
		outln('NO')
		continue
	if y1 - y2 == 0 and (c > 0 or d > 0):
		outln('NO')
		continue
	if min(x1, x2) <= x <= x2 and y1 <= y <= y2:
		outln('YES')
		continue
	outln('NO')


def f(l1, l2):
	(a, b, c, d) = l1
	(x, y, x1, y1, x2, y2) = l2
	if x1 == x2 and (a > 0 or b > 0):
		return False
	if y1 == y2 and (c > 0 or d > 0):
		return False
	x += b - a
	y += d - c
	return x >= x1 and x <= x2 and (y >= y1) and (y <= y2)
q = int(input())
for _ in range(q):
	l1 = list(map(int, input().split()))
	l2 = list(map(int, input().split()))
	print('Yes' if f(l1, l2) else 'No')


t = int(input())
for _ in range(t):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	canLeft = abs(x - x1)
	canRight = abs(x2 - x)
	canDown = abs(y - y1)
	canUp = abs(y2 - y)
	if canLeft == 0 and canRight == 0:
		if a != 0 or b != 0:
			print('NO')
			continue
		else:
			pass
	elif canLeft < a - b or canRight < b - a:
		print('NO')
		continue
	else:
		pass
	if canDown == 0 and canUp == 0:
		if c != 0 or d != 0:
			print('NO')
			continue
		else:
			pass
	elif canDown < c - d or canUp < d - c:
		print('NO')
		continue
	else:
		pass
	print('YES')


times = int(input())
ans_list = []
for i in range(times):
	arr_turnes = input()
	arr_turnes = arr_turnes.split()
	a = int(arr_turnes[0])
	b = int(arr_turnes[1])
	c = int(arr_turnes[2])
	d = int(arr_turnes[3])
	arr_coord = input()
	arr_coord = arr_coord.split()
	x = int(arr_coord[0])
	y = int(arr_coord[1])
	x1 = int(arr_coord[2])
	y1 = int(arr_coord[3])
	x2 = int(arr_coord[4])
	y2 = int(arr_coord[5])
	if x1 == x2 and (a > 0 or b > 0) or (y1 == y2 and (c > 0 or d > 0)):
		ans_list.append('No')
	elif x1 <= x - a + b <= x2 and y1 <= y - c + d <= y2:
		ans_list.append('Yes')
	else:
		ans_list.append('No')
for i in range(times):
	print(ans_list[i])


def linput():
	return [int(i) for i in input().split()]
q = int(input())
for ______ in range(q):
	(a, b, c, d) = linput()
	(x, y, x1, y1, x2, y2) = linput()
	p = 0
	if (a == -2 * b or x != x1 or x != x2 or (b == 0)) and x1 <= x - a + b <= x2:
		if (c == -2 * d or y != y1 or y != y2 or (d == 0)) and y1 <= y - c + d <= y2:
			p = 1
	if p == 1:
		print('Yes')
	else:
		print('No')


for _ in range(int(input())):
	(l, r, d, u) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	hl = x - x1
	hr = x2 - x
	hu = y2 - y
	hd = y - y1
	f = 0
	if hl >= 1 and hr >= 1:
		if l > r:
			l = l - r
			r = 0
			if l > hl:
				print('NO')
				f = 1
		else:
			r = r - l
			l = 0
			if r > hr:
				print('NO')
				f = 1
	elif hl >= 1 and hr == 0:
		if r > l:
			print('NO')
			f = 1
		elif l - r > hl:
			print('No')
			f = 1
	elif hr >= 1 and hl == 0:
		if l > r:
			print('NO')
			f = 1
		elif r - l > hr:
			print('No')
			f = 1
	elif l != 0 or r != 0:
		print('NO')
		f = 1
	if f == 0:
		if hd >= 1 and hu >= 1:
			if d > u:
				d = d - u
				u = 0
				if d > hd:
					print('NO')
					f = 1
			else:
				u = u - d
				d = 0
				if u > hu:
					print('NO')
					f = 1
		elif hd >= 1 and hu == 0:
			if u > d:
				print('NO')
				f = 1
			elif d - u > hd:
				print('No')
				f = 1
		elif hu >= 1 and hd == 0:
			if d > u:
				print('NO')
				f = 1
			elif u - d > hu:
				print('No')
				f = 1
		elif d != 0 or u != 0:
			print('NO')
			f = 1
	if f == 0:
		print('YES')


import sys
readline = sys.stdin.readline
T = int(readline())
Ans = [None] * T
for qu in range(T):
	(a, b, c, d) = map(int, readline().split())
	(x, y, x1, y1, x2, y2) = map(int, readline().split())
	Xe = x1 == x == x2
	Ye = y1 == y == y2
	(gx, gy) = (x + b - a, y + d - c)
	if not x1 <= gx <= x2 or not y1 <= gy <= y2:
		Ans[qu] = 'NO'
		continue
	if Xe and Ye:
		Ans[qu] = 'NO'
		continue
	if Xe:
		if a or b:
			Ans[qu] = 'NO'
		else:
			Ans[qu] = 'YES'
		continue
	if Ye:
		if c or d:
			Ans[qu] = 'NO'
		else:
			Ans[qu] = 'YES'
		continue
	Ans[qu] = 'YES'
print('\n'.join(Ans))


t = int(input())
while t > 0:
	t = t - 1
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	flag = 0
	if a > b:
		if not abs(x - x1) >= abs(a - b):
			print('No')
			flag = 1
	elif b > a:
		if not abs(x2 - x) >= abs(a - b):
			print('No')
			flag = 1
	if a == b and a != 0:
		if abs(x - x1) < 1 and abs(x2 - x) < 1:
			print('No')
			flag = 1
	if flag == 0:
		if c > d:
			if not abs(y - y1) >= abs(c - d):
				print('No')
				flag = 1
		elif d > c:
			if not abs(y2 - y) >= abs(c - d):
				print('No')
				flag = 1
		if c == d and c != 0:
			if abs(y - y1) < 1 and abs(y2 - y) < 1:
				print('No')
				flag = 1
	if flag == 0:
		print('Yes')


for _ in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	(x, y, lx, ly, hx, hy) = map(int, input().split())
	(mx, my) = (b - a, d - c)
	if a + b > 0 and lx == hx or (c + d > 0 and ly == hy):
		print('NO')
	elif lx <= x + mx <= hx and ly <= y + my <= hy:
		print('YES')
	else:
		print('NO')


for t in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	(x, y, xl, yl, xr, yr) = map(int, input().split())
	flag = 1
	if b - a > xr - x or a - b > x - xl:
		flag = 0
	if d - c > yr - y or c - d > y - yl:
		flag = 0
	if xl == xr and a + b > 0:
		flag = 0
	if yl == yr and c + d > 0:
		flag = 0
	if flag == 1:
		print('YES')
	else:
		print('NO')


for x in range(int(input())):
	(l, r, d, u) = [int(x) for x in input().split()]
	(x, y, x1, y1, x2, y2) = [int(x) for x in input().split()]
	stock_l = x - x1
	stock_r = x2 - x
	stock_u = y2 - y
	stock_d = y - y1
	dh = abs(l - r)
	dv = abs(u - d)

	def compare():
		if x1 == x2 and (l != 0 or r != 0) or (y1 == y2 and (u != 0 or d != 0)):
			return False
		if l > r:
			if stock_l - dh < 0:
				return False
		elif stock_r - dh < 0:
			return False
		if u > d:
			if stock_u - dv < 0:
				return False
		elif stock_d - dv < 0:
			return False
		return True
	print('Yes' if compare() else 'No')


import sys
input = lambda : sys.stdin.readline().rstrip()

def I():
	return [int(iI) for iI in input().split()]

def II():
	return int(input())

def SI():
	return [i for i in input()]
for _ in range(II()):
	(a, b, c, d) = I()
	(x, y, x1, y1, x2, y2) = I()
	flag = 0
	a *= -1
	c *= -1
	if x2 - x1 == 0 and (a != 0 or b != 0):
		print('NO')
		continue
	if y2 - y1 == 0 and (c != 0 or d != 0):
		print('NO')
		continue
	if b + a + x >= x1 and b + a + x <= x2:
		if c + d + y >= y1 and c + d + y <= y2:
			flag = 1
	if flag == 1:
		print('Yes')
	else:
		print('No')


t = int(input())
while t:
	(a, b, c, d) = map(int, input().split())
	(m, n, m1, n1, m2, n2) = map(int, input().split())
	m = m + (b - a)
	n = n + (d - c)
	if a + b > 0 and m1 == m2:
		print('No')
	elif c + d > 0 and n1 == n2:
		print('No')
	elif m1 <= m <= m2 and n1 <= n <= n2:
		print('Yes')
	else:
		print('No')
	t -= 1


t = int(input())
while t:
	t = t - 1
	(l, r, d, u) = [int(s) for s in input().split()]
	(x, y, x1, y1, x2, y2) = [int(s) for s in input().split()]
	final_x = x - l + r
	final_y = y - d + u
	ans = 1
	if final_x < x1 or final_x > x2:
		ans = 0
	if final_y < y1 or final_y > y2:
		ans = 0
	if x == x1 == x2 and y == y1 == y2 and (l > 0 or r > 0 or d > 0 or (u > 0)):
		ans = 0
	if y == y1 == y2 and (u > 0 or d > 0):
		ans = 0
	if x == x2 == x1 and (r > 0 or l > 0):
		ans = 0
	if ans:
		print('Yes')
	else:
		print('No')


t = int(input())
while t != 0:
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	newX = x - a + b
	newY = y - c + d
	result = ''
	if newX <= x2 and newX >= x1 and (newY <= y2) and (newY >= y1):
		result = 'YES'
	else:
		result = 'NO'
	if (x == x1 and x == x2) and (a != 0 or b != 0) or ((y == y1 and y == y2) and (c != 0 or d != 0)):
		result = 'NO'
	print(result)
	t -= 1


t = int(input())
ans = []
for z in range(t):
	a = list(map(int, input().split()))
	l = a[0]
	r = a[1]
	d = a[2]
	u = a[3]
	b = list(map(int, input().split()))
	x = b[0]
	y = b[1]
	x1 = b[2]
	y1 = b[3]
	x2 = b[4]
	y2 = b[5]
	if x1 == x2 and y1 == y2:
		ans.append('No')
	elif x1 == x2 and (l != 0 or r != 0):
		ans.append('No')
	elif y1 == y2 and (u != 0 or d != 0):
		ans.append('No')
	else:
		side_diff = 0
		if l > r:
			side_diff = l - r
			l = 1
			r = 0
		else:
			side_diff = r - l
			l = 0
			r = 1
		top_diff = 0
		if u > d:
			top_diff = u - d
			u = 1
			d = 0
		else:
			top_diff = d - u
			u = 0
			d = 1
		if l == 1:
			x -= side_diff
		else:
			x += side_diff
		if u == 1:
			y += top_diff
		else:
			y -= top_diff
		if (x < x1 or x > x2) or (y < y1 or y > y2):
			ans.append('No')
		else:
			ans.append('Yes')
for i in ans:
	print(i)


import sys
lines = [l for l in sys.stdin]
num_of_tests = int(lines[0])
for i in range(num_of_tests):
	(a, b, c, d) = [int(x) for x in lines[2 * i + 1].strip().split(' ')]
	(x, y, x1, y1, x2, y2) = [int(x) for x in lines[2 * i + 2].strip().split(' ')]
	diff_x = a - b
	diff_y = c - d
	is_good = True
	if x - x1 == 0 and x2 - x == 0 and (a > 0 or b > 0):
		is_good = False
	elif y - y1 == 0 and y2 - y == 0 and (c > 0 or d > 0):
		is_good = False
	elif diff_x > abs(x1 - x):
		is_good = False
	elif -1 * diff_x > abs(x2 - x):
		is_good = False
	elif diff_y > abs(y1 - y):
		is_good = False
	elif -1 * diff_y > abs(y2 - y):
		is_good = False
	if is_good:
		print('Yes')
	else:
		print('No')


for t in range(int(input())):
	(a, b, c, d, x, y, x1, y1, x2, y2) = [int(i) for i in input().split() + input().split()]
	if x1 == x == x2 and (a > 0 or b > 0) or (y1 == y == y2 and (c > 0 or d > 0)):
		print('No')
	else:
		count = 0
		if x1 <= x or x2 >= x:
			if a >= b and x - x1 >= a - b:
				count += 1
			elif b >= a and x2 - x >= b - a:
				count += 1
		if y1 <= y or y2 >= y:
			if c >= d and y - y1 >= c - d:
				count += 1
			elif d >= c and y2 - y >= d - c:
				count += 1
		if count == 2:
			print('Yes')
		else:
			print('No')


t = int(input())
for _ in range(t):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	l = x - x1
	r = x2 - x
	dw = y - y1
	u = y2 - y
	if x - x1 == 0 and x2 - x == 0 and (not (a == 0 and b == 0)):
		print('No')
	elif y - y1 == 0 and y2 - y == 0 and (not (c == 0 and d == 0)):
		print('No')
	elif a - b > l or b - a > r or c - d > dw or (d - c > u):
		print('No')
	else:
		print('Yes')


t = int(input())
while t > 0:
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	x = x - a + b
	y = y - c + d
	q = x1 <= x <= x2
	w = y1 <= y <= y2
	e = x1 < x2 or a + b == 0
	f = y1 < y2 or c + d == 0
	if q and w and e and f:
		print('Yes')
	else:
		print('No')
	t = t - 1


for t in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	x = [0] + [int(k) for k in input().split()]
	flag = True
	if a >= b:
		if a - b > x[1] - x[3]:
			flag = False
	elif b - a > x[5] - x[1]:
		flag = False
	if c >= d:
		if c - d > x[2] - x[4]:
			flag = False
	elif d - c > x[6] - x[2]:
		flag = False
	if x[1] == x[3] == x[5] and (a > 0 or b > 0):
		flag = False
	if x[2] == x[4] == x[6] and (c > 0 or d > 0):
		flag = False
	if flag:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	(a, b, c, d) = [int(nr) for nr in input().split()]
	(x, y, x0, y0, x1, y1) = [int(nr) for nr in input().split()]
	right = -a + b
	up = -c + d
	new_x = right + x
	new_y = up + y
	if (a > 0 or b > 0) and (x == x0 and x == x1):
		print('No')
		continue
	if (c > 0 or d > 0) and (y == y0 and y == y1):
		print('No')
		continue
	if new_x > x1 or new_x < x0 or new_y > y1 or (new_y < y0):
		print('No')
	else:
		print('Yes')


I = input
pr = print

def main():
	for _ in range(int(I())):
		(a, b, c, d) = map(int, I().split())
		(x, y, x1, y1, x2, y2) = map(int, I().split())
		x1 -= x
		x2 -= x
		y1 -= y
		y2 -= y
		x = y = 0
		pr('YNeos'[not bool(x1 <= b - a and b - a <= x2 and (y1 <= d - c) and (d - c <= y2) and (x1 * x2 <= 0) and (y1 * y2 <= 0) and (not (x1 == x2 and (a > 0 or b > 0) or (y1 == y2 and (c > 0 or d > 0)))))::2])
main()


debug = 0
if debug:
	print('DEBUG MODE ON')
	f = None

	def new_input():
		global f
		if f == None:
			f = open('input.txt')
		return f.readline()
	input = new_input

def readrange():
	return range(int(input()))

def readint():
	return int(input())

def readarr():
	return [int(x) for x in input().split()]

def readmat(rows):
	return [readarr() for _ in range(rows)]
for _ in readrange():
	(ml, mr, md, mu) = readarr()
	(x, y, x1, y1, x2, y2) = readarr()
	dh = mr - ml
	dv = mu - md
	if x1 == x2 and x1 == x and (ml > 0 or mr > 0):
		print('No')
	elif y1 == y2 and y1 == y and (mu > 0 and md > 0):
		print('No')
	elif x + dh >= x1 and x + dh <= x2 and (y + dv >= y1) and (y + dv <= y2):
		print('Yes')
	else:
		print('No')


t = int(input())
for _ in range(t):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	right = b - a
	up = d - c
	rightSpace = x2 - x
	upSpace = y2 - y
	leftSpace = x1 - x
	downSpace = y1 - y
	if abs(rightSpace) + abs(leftSpace) == 0 and (a != 0 or b != 0) or (abs(upSpace) + abs(downSpace) == 0 and (c != 0 or d != 0)):
		print('NO')
	elif rightSpace < right or upSpace < up or right < leftSpace or (up < downSpace):
		print('NO')
	else:
		print('YES')


import sys
inp = sys.stdin.readline

def input():
	return inp().strip()

def iin():
	return int(input())

def lin():
	return list(map(int, input().split()))

def main():
	T = iin()
	while T:
		T -= 1
		(a, b, c, d) = lin()
		(x, y, x1, y1, x2, y2) = lin()
		nt = 0
		if (a or b) and x2 - x1 == 0:
			nt = 1
		if (c or d) and y2 - y1 == 0:
			nt = 1
		if a > b:
			a -= b
			if x - x1 < a:
				nt = 1
		else:
			b -= a
			if x2 - x < b:
				nt = 1
		if c > d:
			c -= d
			if y - y1 < c:
				nt = 1
		else:
			d -= c
			if y2 - y < d:
				nt = 1
		if nt:
			print('NO')
		else:
			print('YES')
main()


import sys, math
ONLINE_JUDGE = __debug__
if not ONLINE_JUDGE:
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
else:
	input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return s[:len(s) - 1]

def invr():
	return map(int, input().split())
t = 1
t = inp()
for tt in range(t):
	(a, b, c, d) = invr()
	(x, y, x1, y1, x2, y2) = invr()
	q = x + b - a
	w = y + d - c
	if q < x1 or q > x2 or w > y2 or (w < y1) or (a > b and x1 >= x) or (b > a and x >= x2) or (c > d and y1 >= y) or (d > c and y >= y2) or (a == b and a > 0 and (x <= x1) and (x >= x2)) or (c == d and c > 0 and (y <= y1) and (y >= y2)):
		print('No')
	else:
		print('Yes')
sys.stdout.close()


DEBUG = False
if DEBUG:
	import sys
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

def solve():
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	nx = x - a + b
	ny = y - c + d
	if not a and (not b) or (a == b and (x - 1 >= x1 or x + 1 <= x2)) or (a != b and nx >= x1 and (nx <= x2)):
		if not c and (not d) or (c == d and (y - 1 >= y1 or y + 1 <= y2)) or (c != d and ny >= y1 and (ny <= y2)):
			return True
	return False
t = int(input())
for _ in range(t):
	if solve():
		print('Yes')
	else:
		print('No')


for _ in range(int(input())):
	(L, R, D, U) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	if L + R > 0 and x1 == x2:
		print('No')
	elif D + U > 0 and y1 == y2:
		print('No')
	elif x1 <= x - L + R and x - L + R <= x2 and (y1 <= y - D + U) and (y - D + U <= y2):
		print('Yes')
	else:
		print('No')


for _ in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	if a > b and x - x1 >= a - b:
		pass
	elif a < b and x2 - x >= b - a:
		pass
	elif a == b and min(1, a) <= x2 - x1:
		pass
	else:
		print('NO')
		continue
	if c > d and y - y1 >= c - d:
		pass
	elif c < d and y2 - y >= d - c:
		pass
	elif c == d and min(1, c) <= y2 - y1:
		pass
	else:
		print('NO')
		continue
	print('YES')


def program():
	(a, b, c, d) = map(int, input().split())
	(u, v, x1, y1, x2, y2) = map(int, input().split())
	newx = u + b - a
	newy = v + d - c
	if b > a and u == x2 or (a > b and u == x1) or (d > c and v == y2) or (c > d and v == y1):
		print('No')
		return 0
	if b == a and b != 0 and (u == x2) and (u == x1) or (c == d and c != 0 and (v == y2) and (v == y1)):
		print('No')
		return 0
	if newx <= x2 and newx >= x1 and (newy >= y1) and (newy <= y2):
		print('Yes')
	else:
		print('No')
for i in range(int(input())):
	program()


from collections import Counter, defaultdict, deque, namedtuple
from math import gcd
import sys

def read_ints():
	return [int(token) for token in input().split()]

def read_tokens():
	return input().split()

def main():
	T = read_ints()[0]
	for case_no in range(1, T + 1):
		(a, b, c, d) = read_ints()
		(x, y, x1, y1, x2, y2) = read_ints()
		(xf, yf) = (x + b - a, y + d - c)
		good = x1 <= xf <= x2 and y1 <= yf <= y2
		if x1 == x2 and (a > 0 or b > 0):
			good = False
		if y1 == y2 and (d > 0 or c > 0):
			good = False
		print('Yes' if good else 'No')
main()


from sys import stdin, stdout
import math
from itertools import permutations, combinations
from collections import defaultdict
from bisect import bisect_left

def L():
	return list(map(int, stdin.readline().split()))

def In():
	return map(int, stdin.readline().split())

def I():
	return int(stdin.readline())
P = 1000000007
for t in range(I()):
	(a, b, c, d) = In()
	(x, y, x1, y1, x2, y2) = In()
	x += b - a
	y += d - c
	if a + b > 0 and x1 == x2:
		print('No')
	elif c + d > 0 and y1 == y2:
		print('No')
	elif x1 <= x <= x2 and y1 <= y <= y2:
		print('Yes')
	else:
		print('No')


t = int(input())
while t > 0:
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	u = x - a + b
	v = y - c + d
	if x1 == x and a != 0 and (x2 == x) and (b != 0):
		print('No')
	elif y1 == y and c != 0 and (y2 == y) and (d != 0):
		print('No')
	elif x1 <= u and x2 >= u and (y1 <= v) and (y2 >= v):
		print('Yes')
	else:
		print('No')
	t -= 1


from sys import stdin
from collections import deque
mod = 10 ** 9 + 7
import sys
import random
from queue import PriorityQueue
from bisect import bisect_right
from bisect import bisect_left
from collections import defaultdict
from math import sqrt, factorial, gcd, log2, inf, ceil
import heapq
input = lambda : sys.stdin.readline().rstrip()
from sys import stdin, stdout
from heapq import heapify, heappush, heappop
from itertools import permutations
from math import factorial as f

def ncr(n, r, p):
	num = den = 1
	for i in range(r):
		num = num * (n - i) % p
		den = den * (i + 1) % p
	return num * pow(den, p - 2, p) % p
t = int(input())
for _ in range(t):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	if x1 == x2 == x:
		if a + b > 0:
			print('NO')
			continue
	if y1 == y2 == y:
		if c + d > 0:
			print('NO')
			continue
	if x1 <= x - a + b <= x2 and y1 <= y + d - c <= y2:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	(l, r, d, u) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	if x1 == x2 and (l > 0 or r > 0):
		print('No')
	elif y1 == y2 and (u > 0 or d > 0):
		print('No')
	else:
		if l > r:
			pox = -(abs(l) - abs(r)) + x
		else:
			pox = r - l + x
		if d > u:
			poy = -(abs(d) - abs(u)) + y
		else:
			poy = u - d + y
		if (pox >= x1 and pox <= x2) and (poy >= y1 and poy <= y2):
			print('Yes')
		else:
			print('No')


for t in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	flag = 0
	if a > b:
		if abs(x - x1) < a - b:
			flag = 1
	elif a < b:
		if abs(x - x2) < b - a:
			flag = 1
	elif abs(x - x2) == 0 and abs(x - x1) == 0 and (a > 0):
		flag = 1
	if c > d:
		if abs(y - y1) < c - d:
			flag = 1
	elif c < d:
		if abs(y - y2) < d - c:
			flag = 1
	elif abs(y - y1) == 0 and abs(y - y2) == 0 and (c > 0):
		flag = 1
	if flag == 1:
		print('NO')
	else:
		print('YES')


import sys
from heapq import *
from collections import defaultdict as dd
input = lambda : sys.stdin.readline().strip()
inp = lambda : list(map(int, input().split()))
for _ in range(int(input())):
	(a, b, c, d) = inp()
	(x, y, x1, y1, x2, y2) = inp()
	flag = True
	xx = x - (a - b)
	yy = y - (c - d)
	if xx > x2 or xx < x1 or yy > y2 or (yy < y1):
		flag = False
	if x1 == x2 and (a > 0 or b > 0):
		flag = False
	if y1 == y2 and (c > 0 or d > 0):
		flag = False
	print('YES' if flag else 'NO')


for _ in range(int(input())):
	(a, b, c, d) = list(map(int, input().split()))
	(x, y, x1, y1, x2, y2) = list(map(int, input().split()))
	if x1 == x2 and a + b >= 1:
		print('NO')
	elif y1 == y2 and c + d >= 1:
		print('NO')
	else:
		sidewise = b - a
		updown = d - c
		flag1 = 0
		flag2 = 0
		if sidewise < 0:
			x -= abs(sidewise)
			if x >= x1:
				flag1 = 1
		else:
			x += sidewise
			if x <= x2:
				flag1 = 1
		if updown < 0:
			y -= abs(updown)
			if y >= y1:
				flag2 = 1
		else:
			y += updown
			if y <= y2:
				flag2 = 1
		if flag1 and flag2:
			print('YES')
		else:
			print('NO')


for _ in range(int(input())):
	(left, right, down, up) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	if not (x1 <= x - left + right <= x2 and y1 <= y - down + up <= y2):
		print('No')
	elif (right or left) and x2 - x1 == 0 or ((up or down) and y2 - y1 == 0):
		print('No')
	else:
		print('Yes')


t = int(input())
for i in range(t):
	w = list(map(int, input().split()))
	(l, r, d, u) = (w[0], w[1], w[2], w[3])
	q = list(map(int, input().split()))
	(x1, y1, x2, y2) = (q[2], q[3], q[4], q[5])
	x = q[0] - l + r
	y = q[1] - d + u
	if x1 == x2 and x1 == q[0] and (l != 0 or r != 0) or (y1 == y2 and y1 == q[1] and (u != 0 or d != 0)):
		print('No')
	elif x1 <= x <= x2 and y1 <= y <= y2:
		print('Yes')
	else:
		print('No')


t = int(input())
for _ in range(t):
	temp = list(map(int, input().split()))
	l = temp[0]
	r = temp[1]
	d = temp[2]
	u = temp[3]
	temp = list(map(int, input().split()))
	x = temp[0]
	y = temp[1]
	x1 = temp[2]
	y1 = temp[3]
	x2 = temp[4]
	y2 = temp[5]
	hori = r - l
	verti = u - d
	horiDiff = abs(x2 - x1)
	vertiDiff = abs(y2 - y1)
	if x != 0:
		x1 = x1 - x
		x2 = x2 - x
		x = 0
	if y != 0:
		y1 = y1 - y
		y2 = y2 - y
		y = 0
	if vertiDiff == 0:
		if u != 0 or d != 0:
			print('No')
			continue
	if horiDiff == 0:
		if l != 0 or r != 0:
			print('No')
			continue
	if not (hori >= x1 and hori <= x2):
		print('No')
		continue
	if not (verti >= y1 and verti <= y2):
		print('No')
		continue
	print('Yes')


q = int(input())
for _ in range(q):
	(i, j, k, l) = map(int, input().split())
	(a, b, c, d, e, f) = map(int, input().split())
	canx = j - i
	cany = l - k
	flag = True
	if e == c and (i != 0 or j != 0):
		flag = False
	if f == d and (k != 0 or l != 0):
		flag = False
	lastx = a + canx
	lasty = b + cany
	if c <= lastx <= e and d <= lasty <= f:
		pass
	else:
		flag = False
	print('Yes' if flag else 'No')


def check(x0, x1, x2, left, right):
	if right > left:
		return right - left <= x2 - x0
	elif right < left:
		return left - right <= x0 - x1
	else:
		if x1 == x0 == x2:
			return left == 0 and right == 0
		return True
n = int(input())
for i in range(n):
	(left, right, down, up) = [int(x) for x in input().split()]
	(x0, y0, x1, y1, x2, y2) = [int(x) for x in input().split()]
	flag = check(x0, x1, x2, left, right)
	flag &= check(y0, y1, y2, down, up)
	if flag:
		print('Yes')
	else:
		print('No')


t = int(input())
for _ in range(t):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	if x1 == x2:
		if x == x1:
			if a == 0 and b == 0:
				pass
			else:
				print('No')
				continue
		else:
			print('No')
			continue
	if y1 == y2:
		if y == y1:
			if c == 0 and d == 0:
				pass
			else:
				print('No')
				continue
		else:
			print('No')
			continue
	if x >= x1 and x <= x2 and (y >= y1) and (y <= y2):
		z = b - a
		x = x + z
		if x >= x1 and x <= x2:
			z = d - c
			y = y + z
			if y >= y1 and y <= y2:
				print('Yes')
			else:
				print('No')
		else:
			print('No')
	else:
		print('No')


import sys
input = sys.stdin.readline
from math import *
from bisect import *
from functools import reduce, lru_cache
from collections import Counter, defaultdict
for _ in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	(x0, y0, x1, y1, x2, y2) = map(int, input().split())
	if x2 - x1 == 0 and (a != 0 or b != 0):
		print('No')
		continue
	if y2 - y1 == 0 and (c != 0 or d != 0):
		print('No')
		continue
	if not x1 <= x0 + b - a <= x2 or not y1 <= y0 + d - c <= y2:
		print('No')
		continue
	print('Yes')


from sys import stderr
for _ in range(int(input())):
	(n_left, n_right, n_down, n_up) = map(int, input().split(' '))
	(x, y, x_left, y_bottom, x_right, y_top) = map(int, input().split(' '))
	if not x_left <= x <= x_right:
		print('No')
		continue
	elif x_left == x_right and (n_left or n_right):
		print('No')
		continue
	elif not x_left <= x - n_left + n_right <= x_right:
		print('No')
		continue
	elif not y_bottom <= y <= y_top:
		print('No')
		continue
	elif y_bottom == y_top and (n_down or n_up):
		print('No')
		continue
	elif not y_bottom <= y - n_down + n_up <= y_top:
		print('No')
		continue
	print('Yes')


t = int(input())
for _ in range(t):
	(a, b, c, d) = [int(x) for x in input().strip().split()]
	(x, y, x1, y1, x2, y2) = [int(x) for x in input().strip().split()]
	lflag = False
	vflag = False
	if x + b - a >= x1 and x + b - a <= x2:
		if x2 - x >= 1 or x - x1 >= 1:
			lflag = True
	if y + d - c >= y1 and y + d - c <= y2:
		if y2 - y >= 1 or y - y1 >= 1:
			vflag = True
	if a == 0 and b == 0:
		lflag = True
	if c == 0 and d == 0:
		vflag = True
	if lflag and vflag:
		print('Yes')
	else:
		print('No')


t = int(input())
for test in range(t):
	(a, b, c, d) = [int(i) for i in input().split()]
	(x, y, x1, y1, x2, y2) = [int(i) for i in input().split()]
	if not x1 <= x - a + b <= x2 or (x1 == x == x2 and (a or b != 0)):
		print('NO')
		continue
	if not y1 <= y - c + d <= y2 or (y1 == y == y2 and (c or d != 0)):
		print('NO')
		continue
	print('YES')


t = int(input())
for _ in range(t):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	f = 0
	f1 = 0
	if x == x1 == x2:
		if a == 0 and b == 0:
			f = 1
		else:
			print('No')
			continue
	if y == y1 == y2:
		if c == 0 and d == 0:
			f1 = 1
		else:
			print('No')
			continue
	if a > b:
		p = abs(abs(a) - abs(b))
		if p <= abs(x1 - x):
			f = 1
	else:
		p = b - a
		if p <= abs(x2 - x):
			f = 1
	if c > d:
		q = c - d
		if q <= abs(y1 - y):
			f1 = 1
	else:
		q = d - c
		if q <= abs(y2 - y):
			f1 = 1
	if f == 1 and f1 == 1:
		print('Yes')
	else:
		print('No')


from sys import stdin, stdout
import collections
import heapq
import itertools
import functools
import math
import operator
import string
ALPHABET = string.ascii_lowercase
DIGITS = string.digits

def read_line():
	return stdin.readline().strip()

def read_int():
	return int(read_line())

def read_arr():
	return read_line().split(' ')

def read_int_arr():
	return [int(x) for x in read_arr()]

def query_interactive(s):
	print(s)
	stdout.flush()

def solve():
	(a, b, c, d) = read_int_arr()
	(x, y, x1, y1, x2, y2) = read_int_arr()
	net_left = a - b
	net_up = d - c
	if a > 0 or b > 0:
		if x == x1 and x == x2:
			print('NO')
			return
		(lb, ub) = (x1, x2)
		if not lb <= x - net_left <= ub:
			print('NO')
			return
	if c > 0 or d > 0:
		if y == y1 and y == y2:
			print('NO')
			return
		(lb, ub) = (y1, y2)
		if not lb <= net_up + y <= ub:
			print('NO')
			return
	print('YES')

def main():
	T = 1
	T = read_int()
	for _ in range(T):
		solve()
main()


t = int(input())
for _ in range(t):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	(gx, gy) = (x - a + b, y - c + d)
	res = x1 <= x <= x2 and x1 <= gx <= x2 and (y1 <= y <= y2) and (y1 <= gy <= y2)
	if res and ((a or b) and x2 == x1) or ((c or d) and y1 == y2):
		res = False
	ans = 'Yes' if res else 'No'
	print(ans)


t = int(input())
for i in range(t):
	(a, b, c, d) = [int(j) for j in input().split()]
	(x, y, x1, y1, x2, y2) = [int(j) for j in input().split()]
	c1 = x1 <= x - a + b <= x2
	c2 = y1 <= y - c + d <= y2
	if x1 == x == x2 and abs(a) + abs(b) > 0:
		print('NO')
	elif y1 == y == y2 and abs(c) + abs(d) > 0:
		print('NO')
	elif c1 and c2:
		print('YES')
	else:
		print('NO')


from math import ceil
from collections import deque
for _ in range(int(input())):
	(a, b, c, d) = [int(i) for i in input().split()]
	(x, y, x1, y1, x2, y2) = [int(i) for i in input().split()]
	f = 0
	if x2 == x1 and a != 0:
		f = 1
	if y2 == y1 and c != 0:
		f = 1
	if b - a > x2 - x or a - b > x - x1:
		f = 1
	if d - c > y2 - y or c - d > y - y1:
		f = 1
	if f:
		print('NO')
	else:
		print('YES')


import sys
input = sys.stdin.readline

def main():
	t = int(input())
	for _ in range(t):
		(A, B, C, D) = [int(x) for x in input().split()]
		(X, Y, X1, Y1, X2, Y2) = [int(x) for x in input().split()]
		if X == X1 == X2 and (A != 0 or B != 0):
			print('No')
			continue
		if Y == Y1 == Y2 and (C != 0 or D != 0):
			print('No')
			continue
		if not X1 <= -A + B + X <= X2:
			print('No')
			continue
		if not Y1 <= -C + D + Y <= Y2:
			print('No')
			continue
		print('Yes')
main()


tim = int(input())
while tim:
	tim -= 1
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	xend = x - a + b
	yend = y - c + d
	if xend >= x1 and xend <= x2 and (yend >= y1) and (yend <= y2):
		tag = 1
		if min(a, b) > 0 and x1 == x2:
			tag = 0
		if min(c, d) > 0 and y1 == y2:
			tag = 0
		if tag:
			print('Yes')
		else:
			print('No')
	else:
		print('No')


for i in range(int(input())):
	(left, right, down, up) = [int(each) for each in input().split(' ')]
	(x, y, x1, y1, x2, y2) = [int(each) for each in input().split(' ')]
	ans = 'YES'
	if left > right:
		if x - (left - right) < x1:
			ans = 'NO'
	elif left < right:
		if x + (right - left) > x2:
			ans = 'No'
	elif x == x1 == x2 and left > 0:
		ans = 'NO'
	if down > up:
		if y - (down - up) < y1:
			ans = 'NO'
	elif down < up:
		if y + (up - down) > y2:
			ans = 'NO'
	elif y == y1 == y2 and down > 0:
		ans = 'NO'
	print(ans)


for T in range(int(input())):
	(l, r, d, u) = list(map(int, input().split()))
	(x, y, x1, y1, x2, y2) = list(map(int, input().split()))
	hr = r - l
	v = u - d
	m = max(abs(x - x1), abs(x2 - x))
	n = max(abs(y - y1), abs(y - y2))
	if x1 == x2 and (r or l):
		print('No')
	elif y1 == y2 and (u or d):
		print('No')
	elif v > 0 and v > y2 - y:
		print('No')
	elif v < 0 and -1 * v > y - y1:
		print('No')
	elif hr > 0 and hr > x2 - x:
		print('No')
	elif hr < 0 and -1 * hr > x - x1:
		print('No')
	else:
		print('Yes')


from collections import defaultdict
t = int(input())
for _ in range(t):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	print('NO' if b - a + x > x2 or b - a + x < x1 or d - c + y > y2 or (d - c + y < y1) or (a * b > 0 and x1 == x == x2) or (c * d > 0 and y1 == y == y2) else 'YES')


for _ in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	(x, y, grid_x1, grid_y1, grid_x2, grid_y2) = map(int, input().split())
	if x == grid_x1 and a > b or (x == grid_x2 and b > a) or (x == grid_x1 == grid_x2 and b == a and (b != 0) and (a != 0)):
		print('NO')
	elif y == grid_y1 and c > d or (y == grid_y2 and d > c) or (y == grid_y1 == grid_y2 and d == c and (d != 0) and (c != 0)):
		print('NO')
	else:
		x += b
		x -= a
		y += d
		y -= c
		if not grid_x1 <= x <= grid_x2:
			print('NO')
		elif not grid_y1 <= y <= grid_y2:
			print('NO')
		else:
			print('YES')


for t in range(int(input())):
	(a, b, c, d) = map(int, input().split(' '))
	(x, y, x1, y1, x2, y2) = map(int, input().split(' '))
	allowed = 1
	if x == x1 and x == x2:
		if a > 0 or b > 0:
			allowed = 0
	if y == y1 and y == y2:
		if c > 0 or d > 0:
			allowed = 0
	if a >= b:
		hor = a - b
		if x - hor < x1:
			allowed = 0
	elif a < b:
		hor = b - a
		if x + hor > x2:
			allowed = 0
	if c >= d:
		ver = c - d
		if y - ver < y1:
			allowed = 0
	elif c < d:
		ver = d - c
		if y + ver > y2:
			allowed = 0
	if allowed == 0:
		print('No')
	else:
		print('Yes')


import sys, bisect
from math import gcd
input = sys.stdin.readline

def inp():
	return int(input().rstrip())

def inlt():
	return list(map(int, input().rstrip().split()))

def insr():
	s = input().rstrip()
	return s[:len(s) - 1]

def invr():
	return map(int, input().rstrip().split())
t = inp()
for _ in range(t):
	(a, b, c, d) = invr()
	(x, y, x1, y1, x2, y2) = invr()
	if x1 <= x <= x2 and y1 <= y <= y2:
		if a > 0 or b > 0:
			if x2 - x1 <= 0:
				print('NO')
				continue
		if c > 0 or d > 0:
			if y2 - y1 <= 0:
				print('NO')
				continue
		(final_x, final_y) = (x + (b - a), y + (d - c))
		if x1 <= final_x <= x2 and y1 <= final_y <= y2:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


for _ in range(int(input())):
	(left, right, down, up) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	x = x + right - left
	y = y + up - down
	if x1 <= x <= x2 and y1 <= y <= y2:
		if x1 == x2 and (left > 0 or right > 0) or (y1 == y2 and (down > 0 or up > 0)):
			print('NO')
		else:
			print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	(a, b, c, d) = [int(x) for x in input().split()]
	(x, y, x1, y1, x2, y2) = [int(x) for x in input().split()]
	xend = x + b - a
	yend = y + d - c
	flag = 0
	if x >= x1 and x <= x2 and (y >= y1) and (y <= y2):
		if xend >= x1 and xend <= x2 and (yend >= y1) and (yend <= y2):
			flag = 1
			if (a or b) and x1 == x2:
				flag = 0
			if (c or d) and y1 == y2:
				flag = 0
	if flag:
		print('YES')
	else:
		print('NO')


from math import inf
t = int(input())
for q in range(t):
	(a, b, c, d) = [int(i) for i in input().split()]
	(x, y, x1, y1, x2, y2) = [int(i) for i in input().split()]
	dif1 = a - b
	dif2 = c - d
	if x1 <= x - dif1 <= x2 and y1 <= y - dif2 <= y2 and (x2 - x1 or (not a and (not b))) and (y2 - y1 or (not c and (not d))):
		print('Yes')
	else:
		print('No')


t = int(input())
for i in range(t):
	(a, b, c, d) = list(map(int, input().split()))
	(x, y, x1, y1, x2, y2) = list(map(int, input().split()))
	px = x + b - a
	py = y + d - c
	hok = True
	vok = True
	if a > 0 or b > 0:
		if not abs(x2 - x1) > 0:
			hok = False
	if c > 0 or d > 0:
		if not abs(y2 - y1 > 0):
			vok = False
	if px >= x1 and px <= x2 and (py >= y1) and (py <= y2) and hok and vok:
		print('YES')
	else:
		print('NO')


import math
n = int(input())
for i in range(n):
	ans = 'NO'
	(a, b, c, d) = [int(i) for i in input().split()]
	(x, y, x1, y1, x2, y2) = [int(i) for i in input().split()]
	left = abs(a - b)
	right = abs(c - d)
	if a >= b:
		x = x - left
	else:
		x = x + left
	if c >= d:
		y = y - right
	else:
		y = y + right
	if x >= x1 and x <= x2 and (y >= y1) and (y <= y2):
		ans = 'YES'
	if abs(x2 - x1) == 0 and (a != 0 or b != 0):
		ans = 'NO'
	if abs(y2 - y1) == 0 and (c != 0 or d != 0):
		ans = 'NO'
	print(ans)


R = lambda : map(int, input().split())
(t,) = R()
for _ in [0] * t:
	(a, b, c, d) = R()
	(x, y, u, v, w, z) = R()
	print('NYOE S'[w - u >= (a == b > 0) and u <= x + b - a <= w and (z - v >= (c == d > 0)) and (v <= y + d - c <= z)::2])


from math import *
from collections import *
import sys
input = sys.stdin.readline
t = int(input())
while t:
	t -= 1
	(a, b, c, d) = map(int, input().split())
	(a1, b1, c1, d1) = (a, b, c, d)
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	if x1 == x2 and y2 == y1 and (a > 0 or b > 0 or c > 0 or (d > 0)):
		print('No')
		continue
	yax = abs(y1 - y2)
	xax = abs(x1 - x2)
	cx = max(abs(x - x1), abs(x - x2))
	cy = max(abs(y - y1), abs(y - y2))
	flag = 0
	(a, b) = (max(0, a - b), max(0, b - a))
	(c, d) = (max(0, c - d), max(0, d - c))
	if a <= abs(x - x1) and b <= abs(x - x2):
		pass
	else:
		flag = 1
	if abs(x1 - x2) == 0 and (a1 > 0 or b1 > 0):
		flag = 1
	if c <= abs(y - y1) and d <= abs(y - y2):
		pass
	else:
		flag = 1
	if abs(y1 - y2) == 0 and (c1 > 0 or d1 > 0):
		flag = 1
	if flag == 0:
		print('Yes')
	else:
		print('No')


from functools import reduce
import os
import sys
from math import *
from collections import *
from fractions import *
from bisect import *
from heapq import *
from io import BytesIO, IOBase
input = lambda : sys.stdin.readline().rstrip('\r\n')

def value():
	return tuple(map(int, input().split()))

def arr():
	return [int(i) for i in input().split()]

def sarr():
	return [int(i) for i in input()]

def inn():
	return int(input())
mo = 1000000007
for _ in range(int(input())):
	(a, b, c, d) = value()
	(x, y, x1, y1, x2, y2) = value()
	x += b - a
	y += d - c
	if a + b >= 1 and x1 == x2 or (c + d >= 1 and y1 == y2):
		print('NO')
	elif x1 <= x <= x2 and y1 <= y <= y2:
		print('YES')
	else:
		print('NO')


T = int(input().split()[0])
for Case in range(T):
	(a, b, c, d) = [int(x) for x in input().split()]
	(x, y, x1, y1, x2, y2) = [int(x) for x in input().split()]
	if x1 == x2:
		if a or b:
			print('No')
			continue
	if y1 == y2:
		if c or d:
			print('No')
			continue
	x += b - a
	y += d - c
	if x < x1 or x > x2 or y < y1 or (y > y2):
		print('No')
	else:
		print('Yes')


def cat(a, b, c, d, x, y, x1, y1, x2, y2):
	if x1 == x2:
		if a == 0 and b == 0:
			pass
		else:
			return 'NO'
	if y1 == y2:
		if c == 0 and d == 0:
			pass
		else:
			return 'NO'
	(m, n) = (b - a, d - c)
	if (x + m < x1 or x + m > x2) or (y + n < y1 or y + n > y2):
		return 'NO'
	return 'YES'
import math
for i in range(int(input())):
	(a, b, c, d) = list(map(int, input().split()))
	(x, y, x1, y1, x2, y2) = list(map(int, input().split()))
	print(cat(a, b, c, d, x, y, x1, y1, x2, y2))


import sys
import math
get_string = lambda : sys.stdin.readline().strip()
get_int_list = lambda : list(map(int, sys.stdin.readline().strip().split()))
get_int = lambda : int(sys.stdin.readline())
for _ in range(get_int()):
	(a, b, c, d) = get_int_list()
	(x, y, x1, y1, x2, y2) = get_int_list()
	flag = True
	if abs(x2 - x1) == 0 and a + b != 0:
		flag = False
	if abs(y2 - y1) == 0 and c + d != 0:
		flag = False
	x = x - a + b
	y = y - c + d
	if not x1 <= x <= x2 or not y1 <= y <= y2:
		flag = False
	if flag:
		print('Yes')
	else:
		print('No')


for _ in range(int(input())):
	ge = 0
	(l, r, d, u) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	totalv = u - d
	totalh = r - l
	ans = True
	if x1 == x2 and l + r != 0 or (y1 == y2 and u + d != 0):
		print('No')
		continue
	if totalh > 0:
		if x2 - x < totalh:
			ans = False
	elif abs(x1 - x) < abs(totalh):
		ans = False
	if totalv > 0:
		if y2 - y < totalv:
			ans = False
	elif abs(y1 - y) < abs(totalv):
		ans = False
	if ans:
		print('Yes')
	else:
		print('No')


t = int(input())
while t > 0:
	t -= 1
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	ok = True
	if b - a > x2 - x or a - b > x - x1:
		ok = False
	if d - c > y2 - y or c - d > y - y1:
		ok = False
	if x1 == x2 and a + b > 0:
		ok = False
	if y1 == y2 and c + d > 0:
		ok = False
	if ok:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	if x1 == x2 and a + b > 0 or (y1 == y2 and c + d > 0):
		print('NO')
		continue
	dx = max(a, b) - min(a, b)
	dy = max(c, d) - min(c, d)
	px = x + dx * (1 if b > a else -1)
	py = y + dy * (1 if d > c else -1)
	print('YES' if x1 <= px <= x2 and y1 <= py <= y2 else 'NO')


for case in range(int(input())):
	(a, b, c, d) = [int(x) for x in input().split()]
	(x, y, x1, y1, x2, y2) = [int(x) for x in input().split()]
	side_range = 0
	vertical_range = 0
	if x1 == x2 and (a > 0 or b > 0):
		print('No')
	elif y1 == y2 and (c > 0 or d > 0):
		print('No')
	else:
		if x * x1 >= 0:
			left_range = abs(x - x1)
		else:
			left_range = abs(x) + abs(x1)
		if x * x2 >= 0:
			right_range = abs(x - x2)
		else:
			right_range = abs(x) + abs(x2)
		if y * y1 >= 0:
			up_range = abs(y - y1)
		else:
			up_range = abs(y) + abs(y1)
		if y * y2 >= 0:
			down_range = abs(y - y2)
		else:
			down_range = abs(y) + abs(y2)
		if a - b > left_range or b - a > right_range or c - d > up_range or (d - c > down_range):
			print('No')
		else:
			print('Yes')


import math
t = int(input())
for _ in range(t):
	(a, b, c, d) = map(int, input().split())
	a1 = [int(s) for s in input().split()]
	if (a1[2] <= b - a + a1[0] and b - a + a1[0] <= a1[4]) and (d - c + a1[1] >= a1[3] and d - c + a1[1] <= a1[5]):
		if ((a == 0 or a1[0] - 1 >= a1[2]) or (b == 0 or a1[0] + 1 <= a1[4])) and ((c == 0 or a1[1] - 1 >= a1[3]) or (d == 0 or a1[1] + 1 <= a1[5])):
			print('Yes')
		else:
			print('No')
	else:
		print('No')


for i in range(int(input())):
	(l, r, d, u) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	if x == x1 == x2 and l + r != 0:
		print('NO')
	elif y == y1 == y2 and d + u != 0:
		print('NO')
	elif x + r - l <= max(x1, x2) and x + r - l >= min(x1, x2) and (y + u - d <= max(y1, y2)) and (y + u - d >= min(y1, y2)):
		print('YES')
	else:
		print('NO')


import sys
input = lambda : sys.stdin.readline().strip()
ipnut = input
for i in range(int(input())):
	(a, b, c, d) = map(int, ipnut().split())
	a -= b
	c -= d
	(x, y, x1, y1, x2, y2) = map(int, ipnut().split())
	if x1 <= x - a <= x2 and (not (a + b or b) or (x != x1 or x != x2)) and (y1 <= y - c <= y2) and (not (c + d or d) or (y != y1 or y != y2)):
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	x3 = []
	y3 = []
	x3.append(a * -1)
	x3.append(b * 1)
	y3.append(c * -1)
	y3.append(d * 1)
	x3.sort()
	y3.sort()
	a1 = x + (abs(x3[1]) - abs(x3[0]))
	a2 = y + (abs(y3[1]) - abs(y3[0]))
	if x1 <= a1 <= x2 and y1 <= a2 <= y2 and (x2 > x1 or a + b == 0) and (y2 > y1 or c + d == 0):
		print('YES')
	else:
		print('NO')


def process():
	(l, r, d, u) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	(xdist, ydist) = (r - l, u - d)
	f = x1 <= x + xdist <= x2 and y1 <= y + ydist <= y2
	if (l > 0 and x - x1 == 0) and (r > 0 and x2 - x == 0):
		return False
	if (d > 0 and y - y1 == 0) and (u > 0 and y2 - y == 0):
		return False
	return f
for _ in range(int(input())):
	print('Yes' if process() else 'No')


n = int(input())
for _ in range(n):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	nx = x - a + b
	ny = y - c + d
	if x1 == x2 and (a != 0 or b != 0) or (y1 == y2 and (c != 0 or d != 0)):
		print('NO')
		continue
	if not nx in range(x1, x2 + 1) or not ny in range(y1, y2 + 1):
		print('NO')
	else:
		print('YES')


from sys import stdin, stdout
import math
import heapq
t = 1

def aint():
	return int(input().strip())

def lint():
	return list(map(int, input().split()))

def fint():
	return list(map(int, stdin.readline().split()))

def main():
	(a, b, c, d) = lint()
	(x, y, x1, y1, x2, y2) = lint()
	dx = b - a
	dy = d - c
	if x1 == x2 and (a > 0 or b > 0):
		print('No')
	elif y1 == y2 and (c > 0 or d > 0):
		print('No')
	elif x1 <= x + dx <= x2 and y1 <= y + dy <= y2:
		print('Yes')
	else:
		print('No')
t = int(input())
for i in range(t):
	main()


from math import *
from bisect import bisect_left, bisect_right
from sys import stdin, stdout, setrecursionlimit
from collections import Counter
input = lambda : stdin.readline().strip()
print = stdout.write
t = int(input())
for _ in range(t):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	if not x1 <= x <= x2 or not y1 <= y <= y2:
		print('No\n')
	elif a == b == c == d == 0:
		print('Yes\n')
	elif a == b and a != 0 and (not (x1 <= x - 1 <= x2 or x1 <= x + 1 <= x2)):
		print('No\n')
	elif c == d and c != 0 and (not (y1 <= y - 1 <= y2 or y1 <= y + 1 <= y2)):
		print('No\n')
	elif not x1 <= x - (a - b) <= x2:
		print('No\n')
	elif not y1 <= y - (c - d) <= y2:
		print('No\n')
	else:
		print('Yes\n')


t = int(input())
for i in range(t):
	(l, r, d, u) = list(map(int, input().split()))
	(x, y, x1, y1, x2, y2) = list(map(int, input().split()))
	la = abs(x - x1)
	ra = abs(x - x2)
	ua = abs(y - y2)
	da = abs(y - y1)
	no = 0
	if (l > 0 or r > 0) and (la == 0 and ra == 0):
		print('No')
		no = 1
	elif (d > 0 or u > 0) and (ua == 0 and da == 0):
		print('No')
		no = 1
	if l > r:
		if l - r > la and no != 1:
			print('No')
			no = 1
	if r > l:
		if r - l > ra and no != 1:
			print('No')
			no = 1
	if d > u:
		if d - u > da and no != 1:
			print('No')
			no = 1
	if u > d:
		if u - d > ua and no != 1:
			print('No')
			no = 1
	if no == 0:
		print('Yes')


def solve(l, r, d, u, sx, sy, x1, y1, x2, y2):
	if l > r:
		if sx - x1 < l - r:
			print('No')
			return
	if l < r:
		if x2 - sx < r - l:
			print('No')
			return
	if d > u:
		if sy - y1 < d - u:
			print('No')
			return
	if d < u:
		if y2 - sy < u - d:
			print('No')
			return
	if x1 == x2 and l != 0 and (r != 0):
		print('No')
		return
	if y1 == y2 and d != 0 and (u != 0):
		print('No')
		return
	print('Yes')
	return
T = int(input())
for ti in range(1, T + 1):
	(l, r, d, u) = list(map(int, input().split(' ')))
	(sx, sy, x1, y1, x2, y2) = list(map(int, input().split(' ')))
	solve(l, r, d, u, sx, sy, x1, y1, x2, y2)


n = int(input())
for i in range(n):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	(f1, f2) = (x + b - a, y + d - c)
	ans = 'Yes'
	if not (x1 <= x <= x2 and y1 <= y <= y2 and (x1 <= f1 <= x2) and (y1 <= f2 <= y2)):
		ans = 'No'
	if x == f1 and x1 == x2 and (a != 0) or (y == f2 and y1 == y2 and (c != 0)):
		ans = 'No'
	print(ans)


for _ in range(int(input())):
	(l, r, d, u) = map(int, input().split())
	(x, y, ll, dd, rr, uu) = map(int, input().split())
	m = r - l + x
	n = u - d + y
	if ll <= m and m <= rr and (dd <= n) and (n <= uu):
		if l + r != 0 and ll == rr == x or (u + d != 0 and uu == dd == y):
			print('No')
		else:
			print('Yes')
	else:
		print('No')


import sys
input = sys.stdin.readline
for j in range(int(input())):
	(a, b, c, d) = map(int, input().split(' '))
	(x, y, x1, y1, x2, y2) = map(int, input().split(' '))
	possible = True
	if a == 0 and b > 0:
		if x2 == x:
			possible = False
	elif b == 0 and a > 0:
		if x1 == x:
			possible = False
	if c == 0 and d > 0:
		if y2 == y:
			possible = False
	if d == 0 and c > 0:
		if y1 == y:
			posible = False
	if x - a + b <= x2 and y + d - c <= y2 and (x - a + b >= x1) and (y + d - c >= y1) and (possible == True):
		if (x1 != x or x2 != x or (a == 0 and b == 0)) and (y1 != y or y2 != y or (c == 0 and d == 0)):
			print('Yes')
		else:
			print('No')
	else:
		print('No')


import sys

def findAns():
	(left, right, down, up) = map(int, sys.stdin.readline().strip().split(' '))
	(x, y, xleft, ybottom, xright, ytop) = map(int, sys.stdin.readline().strip().split())
	if (x == xleft and x == xright) and (right != 0 and left != 0):
		return 'No'
	if (y == ybottom and y == ytop) and (down != 0 and up != 0):
		return 'No'
	deltaX = right - left
	deltaY = up - down
	x += deltaX
	y += deltaY
	if xleft <= x and x <= xright and (ybottom <= y) and (y <= ytop):
		return 'Yes'
	else:
		return 'No'
queries = int(sys.stdin.readline())
for query in range(queries):
	print(findAns())


def main():
	t = int(input())
	for _ in range(t):
		(a, b, c, d) = map(int, input().split())
		(x, y, x1, y1, x2, y2) = map(int, input().split())
		if x1 == x2 == x and (a > 0 or b > 0):
			print('No')
			continue
		if y1 == y2 == y and (c > 0 or d > 0):
			print('No')
			continue
		if x1 <= x - a + b <= x2 and y1 <= y - c + d <= y2:
			print('Yes')
		else:
			print('No')
main()


for _ in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	xx = b - a
	yy = d - c
	flg = 0
	if a > 0 and b > 0 and (x1 == x2):
		flg = 1
	if c > 0 and d > 0 and (y1 == y2):
		flg = 1
	if flg == 0 and x1 <= x + xx <= x2 and (y1 <= y + yy <= y2):
		print('Yes')
	else:
		print('No')


from itertools import accumulate
from bisect import bisect_left
arr = [*accumulate(range(100))]
standard_input = '6\n3 2 2 2\n0 0 -2 -2 2 2\n3 1 4 1\n0 0 -1 -1 1 1\n1 1 1 1\n1 1 1 1 1 1\n0 0 0 1\n0 0 0 0 0 1\n5 1 1 1\n0 0 -100 -100 0 100\n1 1 5 1\n0 0 -100 -100 100 0\n'

def solve():
	(a, b, c, d) = map(int, input().split(' '))
	(x, y, x1, y1, x2, y2) = map(int, input().split(' '))
	dx = b - a + x
	dy = d - c + y
	print('No' if dx < x1 or dx > x2 or dy < y1 or (dy > y2) or (abs(x2 - x1) == 0 and (b != 0 or a != 0)) or (abs(y2 - y1) == 0 and (d != 0 or c != 0)) else 'Yes')
t = int(input())
for i in range(t):
	solve()


def iteration():
	(a, b, c, d) = list(map(int, input().split()))
	(x, y, x1, y1, x2, y2) = list(map(int, input().split()))
	abX1 = x - x1
	abX2 = x2 - x
	abY1 = y - y1
	abY2 = y2 - y
	result = True
	if abX1 < a - b or abX2 < b - a:
		result = False
	elif abX1 == 0 and abX2 == 0 and (a > 0 or b > 0):
		result = False
	if abY1 < c - d or abY2 < d - c:
		result = False
	elif abY1 == 0 and abY2 == 0 and (c > 0 or d > 0):
		result = False
	if result:
		print('Yes')
	else:
		print('No')

def main():
	T = int(input())
	for t in range(T):
		iteration()
main()


testcases = int(input())
for i in range(testcases):
	input_1 = input().split()
	[a, b, c, d] = list(map(int, input_1))
	input_2 = input().split()
	[x, y, x1, y1, x2, y2] = list(map(int, input_2))
	if x2 - x >= b - a and x - x1 >= a - b and (y2 - y >= d - c) and (y - y1 >= c - d):
		if x2 - x1 == 0 and a != 0:
			print('No')
		elif y2 - y1 == 0 and c != 0:
			print('No')
		else:
			print('Yes')
	else:
		print('No')


a = []
b = []
for _ in range(int(input())):
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	hor = a[1] - a[0]
	ver = a[3] - a[2]
	if b[0] + hor <= b[4] and b[0] + hor >= b[2] and (b[1] + ver <= b[5]) and (b[1] + ver >= b[3]) and (b[0] - 1 >= b[2] or b[0] + 1 <= b[4] or (a[0] == a[1] and a[0] == 0)) and (b[1] - 1 >= b[3] or b[1] + 1 <= b[5] or (a[2] == a[3] and a[2] == 0)):
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	w = x2 - x1
	h = y2 - y1
	xn = b - a
	yn = d - c
	X = x + xn
	Y = y + yn
	f = 0
	if w == 0:
		if a != 0 or b != 0:
			f = 1
	if h == 0:
		if c != 0 or d != 0:
			f = 1
	if f == 0:
		summ = 1
		if y2 == y1:
			if x2 == x1:
				summ = 0
		if X <= x2 and X >= x1:
			if Y <= y2 and Y >= y1:
				if summ != 0:
					print('Yes')
				else:
					print('No')
			else:
				print('No')
		else:
			print('No')
	else:
		print('No')


import sys
import os
import math
import copy
from math import gcd
from bisect import bisect
from io import BytesIO, IOBase
from math import sqrt, floor, factorial, gcd, log, ceil
from collections import deque, Counter, defaultdict
from itertools import permutations, combinations

def Int():
	return int(sys.stdin.readline())

def Mint():
	return map(int, sys.stdin.readline().split())

def Lstr():
	return list(sys.stdin.readline().strip())

def Str():
	return sys.stdin.readline().strip()

def Mstr():
	return map(str, sys.stdin.readline().strip().split())

def List():
	return list(map(int, sys.stdin.readline().split()))

def Hash():
	return dict()

def Mod():
	return 1000000007

def Ncr(n, r, p):
	return fact[n] * (ifact[r] * ifact[n - r] % p) % p

def Most_frequent(list):
	return max(set(list), key=list.count)

def Mat2x2(n):
	return [List() for _ in range(n)]

def btod(n):
	return int(n, 2)

def dtob(n):
	return bin(n).replace('0b', '')

def solution():
	for _ in range(Int()):
		(a, b, c, d) = Mint()
		(x, y, x1, y1, x2, y2) = Mint()
		x += b - a
		y += d - c
		if a + b > 0 and x1 == x2:
			print('NO')
		elif c + d > 0 and y1 == y2:
			print('NO')
		elif x1 <= x <= x2 and y1 <= y <= y2:
			print('YES')
		else:
			print('NO')
solution()


q = int(input())
for t in range(q):
	(a, b, c, d) = list(map(int, input().split()))
	(x, y, x1, y1, x2, y2) = list(map(int, input().split()))
	if x1 == x2 and (a > 0 or b > 0):
		print('No')
		continue
	if a < b:
		if b - a > x2 - x:
			print('No')
			continue
	elif a - b > x - x1:
		print('No')
		continue
	if y1 == y2 and (c > 0 or d > 0):
		print('No')
		continue
	if c < d:
		if d - c > y2 - y:
			print('No')
			continue
	elif c - d > y - y1:
		print('No')
		continue
	print('Yes')


def read_int():
	n = int(input())
	return n

def read_ints():
	ints = [int(x) for x in input().split(' ')]
	return ints

def solve():
	(a, b, c, d) = read_ints()
	(x, y, x1, y1, x2, y2) = read_ints()
	x1 = x1 - x
	x2 = x2 - x
	y1 = y1 - y
	y2 = y2 - y
	dx = b - a
	dy = d - c
	if a < b:
		if x2 < dx:
			return 'No'
	elif a > b:
		if x1 > dx:
			return 'No'
	elif x1 == 0 and x2 == 0:
		if a != 0 or b != 0:
			return 'No'
	if c < d:
		if y2 < dy:
			return 'No'
	elif c > d:
		if y1 > dy:
			return 'No'
	elif y1 == 0 and y2 == 0:
		if c != 0 and d != 0:
			return 'No'
	return 'Yes'
t = read_int()
for i in range(t):
	print(solve())


from sys import stdin
input = iter(stdin.readlines()).__next__
t = int(input())
for _ in range(t):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	hor = x + (b - a)
	ver = y + (d - c)
	if x1 == x == x2 and a * b > 0:
		print('No')
	elif y1 == y == y2 and c * d > 0:
		print('No')
	elif hor > x and x2 < hor:
		print('No')
	elif hor < x and x1 > hor:
		print('No')
	elif ver > y and y2 < ver:
		print('No')
	elif ver < y and y1 > ver:
		print('No')
	else:
		print('Yes')


t = int(input())
s = []
for jnjbh in range(0, t):
	x = input()
	xx = x.split()
	a = int(xx[0])
	b = int(xx[1])
	c = int(xx[2])
	d = int(xx[3])
	x = input()
	xx = x.split()
	x = int(xx[0])
	y = int(xx[1])
	x1 = int(xx[2])
	y1 = int(xx[3])
	x2 = int(xx[4])
	y2 = int(xx[5])
	if x - x1 == 0 and x2 - x == 0 and (a != 0 or b != 0) or (y - y1 == 0 and y2 - y == 0 and (c != 0 or d != 0)):
		s.append('No')
	else:
		f1 = b - a
		f2 = d - c
		x += f1
		y += f2
		if x1 <= x <= x2 and y1 <= y <= y2:
			s.append('Yes')
		else:
			s.append('No')
for i in s:
	print(i)


t = int(input())

def q():
	abcd = input().split(' ')
	xys = input().split(' ')
	a = int(abcd[0])
	b = int(abcd[1])
	c = int(abcd[2])
	d = int(abcd[3])
	x = int(xys[0])
	y = int(xys[1])
	x1 = int(xys[2])
	y1 = int(xys[3])
	x2 = int(xys[4])
	y2 = int(xys[5])
	bool1 = True
	bool2 = True
	bool3 = True
	bool4 = True
	if x2 == x1 and a != 0 and (b != 0):
		bool3 = False
	if y2 == y1 and c != 0 and (d != 0):
		bool4 = False
	if x - a + b <= x2 and x - a + b >= x1:
		bool1 = True
	else:
		bool1 = False
	if y - c + d <= y2 and y - c + d >= y1:
		bool2 = True
	else:
		bool2 = False
	if bool1 is True and bool2 is True and (bool3 is True) and (bool4 is True):
		print('YES')
	else:
		print('NO')
for i in range(t):
	q()


T = int(input())
for i in range(T):
	(a, b, c, d) = list(map(int, input().split()))
	(x, y, x1, y1, x2, y2) = list(map(int, input().split()))
	v_flag = a != 0 or b != 0
	h_flag = c != 0 or d != 0
	flag = True
	if v_flag:
		m = b - a
		if m != 0:
			if not (x1 <= x + m and x + m <= x2):
				flag = False
		elif not (x + 1 <= x2 or x1 <= x - 1):
			flag = False
	if h_flag:
		m = d - c
		if m != 0:
			if not (y1 <= y + m and y + m <= y2):
				flag = False
		elif not (y + 1 <= y2 or y1 <= y - 1):
			flag = False
	if flag:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	if x1 == x == x2 and (a or b):
		print('No')
		continue
	if y1 == y == y2 and (c or d):
		print('No')
		continue
	d0 = min(a, b, c, d)
	a -= d0
	b -= d0
	c -= d0
	d -= d0
	d1 = min(a, b)
	a -= d1
	b -= d1
	d2 = min(c, d)
	c -= d2
	d -= d2
	a = -a
	c = -c
	if x1 <= x + (a + b) <= x2 and y1 <= y + (c + d) <= y2:
		print('Yes')
	else:
		print('No')


import sys
input = sys.stdin.readline
from collections import defaultdict as dd, deque as dq
t = int(input())
while t:
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	lol = 0
	(aa, bb, cc, dd) = (a, b, c, d)
	a = max(0, a - bb)
	b = max(0, b - aa)
	c = max(0, c - dd)
	d = max(0, d - cc)
	if aa or bb:
		if aa == bb:
			if x - x1 == 0 and x2 - x == 0:
				lol = 1
		elif aa > bb:
			if x - x1 == 0:
				lol = 1
		elif x2 - x == 0:
			lol = 1
	if cc or dd:
		if cc == dd:
			if y - y1 == 0 and y2 - y == 0:
				lol = 1
		elif cc > dd:
			if y - y1 == 0:
				lol = 1
		elif y2 - y == 0:
			lol = 1
	if x - x1 < a:
		lol = 1
	if x2 - x < b:
		lol = 1
	if y - y1 < c:
		lol = 1
	if y2 - y < d:
		lol = 1
	if lol:
		print('No')
	else:
		print('Yes')
	t -= 1


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	(sx, sy, ax, ay, bx, by) = map(int, input().split())
	if ax == bx and a + b != 0 or (ay == by and c + d != 0):
		print('no')
	elif ax <= sx - a + b <= bx and ay <= sy - c + d <= by:
		print('yes')
	else:
		print('no')


def f():
	(l, r, d, u) = [int(s) for s in input().split()]
	(x, y, x1, y1, x2, y2) = [int(s) for s in input().split()]
	(xt, yt) = (x - l + r, y - d + u)
	if xt < x1 or xt > x2 or yt < y1 or (yt > y2):
		print('No')
		return
	if x1 == x2 and l != 0:
		print('No')
		return
	if y1 == y2 and d != 0:
		print('No')
		return
	print('Yes')
for t in range(int(input())):
	f()


t = int(input())
for i in range(0, t):
	n = list(map(int, input().split()))
	l = list(map(int, input().split()))
	p = n[0] - n[1]
	d = n[2] - n[3]
	flag = 0
	if p == 0:
		if n[0] == 0:
			flag = flag + 1
		elif l[4] - l[0] > 0 or l[0] - l[2] > 0:
			flag = flag + 1
	if d == 0:
		if n[2] == 0:
			flag = flag + 1
		elif l[5] - l[1] > 0 or l[1] - l[3] > 0:
			flag = flag + 1
	if p < 0:
		if l[4] - l[0] >= abs(p):
			flag = flag + 1
	if p > 0:
		if l[0] - l[2] >= p:
			flag = flag + 1
	if d < 0:
		if l[5] - l[1] >= abs(d):
			flag = flag + 1
	if d > 0:
		if l[1] - l[3] >= d:
			flag = flag + 1
	if flag == 2:
		print('YES')
	else:
		print('NO')


def within_x_range(x, x1, x2):
	return x1 <= x <= x2

def within_y_range(y, y1, y2):
	return y1 <= y <= y2
t = int(input())
for _ in range(t):
	(a, b, c, d) = list(map(int, input().strip().split()))
	(x, y, x1, y1, x2, y2) = list(map(int, input().strip().split()))
	if a == 0 and b == 0 and (not within_x_range(x, x1, x2)):
		print('No')
		continue
	if c == 0 and d == 0 and (not within_y_range(y, y1, y2)):
		print('No')
		continue
	if a == 0 and b > 0:
		if not within_x_range(x + b, x1, x2):
			print('No')
			continue
	elif b == 0 and a > 0:
		if not within_x_range(x - a, x1, x2):
			print('No')
			continue
	elif a > 0 and b > 0:
		if not (within_x_range(x + 1, x1, x2) or within_x_range(x - 1, x1, x2)):
			print('No')
			continue
	if c == 0 and d > 0:
		if not within_y_range(y + d, y1, y2):
			print('No')
			continue
	elif d == 0 and c > 0:
		if not within_y_range(y - c, y1, y2):
			print('No')
			continue
	elif c > 0 and d > 0:
		if not (within_y_range(y + 1, y1, y2) or within_y_range(y - 1, y1, y2)):
			print('No')
			continue
	if not (within_x_range(x + (b - a), x1, x2) and within_y_range(y + (d - c), y1, y2)):
		print('No')
		continue
	print('Yes')


import sys
tests = int(sys.stdin.readline())
testcount = 0
while testcount < tests:
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	if x2 - x1 == 0 and (a != 0 or b != 0):
		print('No')
	elif y2 - y1 == 0 and (c != 0 or d != 0):
		print('No')
	elif x - a + b >= x1 and x - a + b <= x2 and (y - c + d >= y1) and (y - c + d <= y2):
		print('Yes')
	else:
		print('No')
	testcount += 1


for i in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	e = 0
	if x == x1 == x2:
		if a == b and a == 0:
			pass
		else:
			e = 1
	if y == y1 == y2:
		if c == d and c == 0:
			pass
		else:
			e = 1
	if e == 1:
		print('NO')
	else:
		x3 = x + b - a
		y3 = y + d - c
		if x1 <= x3 <= x2 and y1 <= y3 <= y2:
			print('YES')
		else:
			print('NO')


for _ in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	dx1 = x - x1
	dx2 = x2 - x
	dy1 = y - y1
	dy2 = y2 - y
	f = 1
	if dx1 or dx2:
		x += b - a
	elif a or b:
		f = 0
	if dy1 or dy2:
		y += d - c
	elif c or d:
		f = 0
	if x1 <= x <= x2 and y1 <= y <= y2 and f:
		print('Yes')
	else:
		print('No')


import sys
t = int(input())
for i in range(t):
	(a, b, c, d) = list(map(int, sys.stdin.readline().strip().split()))
	(x, y, x1, y1, x2, y2) = list(map(int, sys.stdin.readline().strip().split()))
	xx = abs(a - b)
	yy = abs(c - d)
	f = 1
	if a > b:
		if xx > x - x1:
			f = 0
	elif a == b and a > 0:
		if x2 - x1 > 0:
			zzz = 0
		else:
			f = 0
	elif b > a:
		if xx > x2 - x:
			f = 0
	if c > d:
		if yy > y - y1:
			f = 0
	elif c == d and c > 0:
		if y2 - y1 > 0:
			zzz = 0
		else:
			f = 0
	elif d > c:
		if yy > y2 - y:
			f = 0
	if f:
		print('YES')
	else:
		print('NO')


from math import *
for t in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	x += b - a
	y += d - c
	if x < x1 or x > x2 or y < y1 or (y > y2):
		print('No')
		continue
	if x1 == x2 and x1 == x and (a != 0 or b != 0):
		print('No')
		continue
	if y1 == y2 and y1 == y and (c != 0 or d != 0):
		print('No')
		continue
	print('Yes')


t = int(input())
for _ in range(t):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	(px, py) = (b - a + x, d - c + y)
	has_horizontal = x1 < x or x < x2
	has_vertical = y1 < y or y < y2
	can = max(d, c) == 0 or has_vertical
	can = can and (max(a, b) == 0 or has_horizontal)
	can = can and x1 <= px <= x2 and (y1 <= py <= y2)
	print('YES' if can else 'NO')


mod = 10 ** 9 + 7
import math
from bisect import bisect_left as bl
from collections import Counter
from itertools import combinations

def ain():
	return map(int, input().split())

def fain():
	return map(float, input().split())

def mc2(s):
	return s * (s - 1) // 2
for _ in range(int(input())):
	(a, b, c, d) = ain()
	(x, y, x1, y1, x2, y2) = ain()
	pos = True
	if not x1 <= x - a + b <= x2:
		pos = False
	if not y1 <= y - c + d <= y2:
		pos = False
	if (a > 0 or b > 0) and x2 == x1:
		pos = False
	if (c > 0 or d > 0) and y2 == y1:
		pos = False
	if pos:
		print('Yes')
	else:
		print('No')


import sys
t = int(input())
for _ in range(t):
	(a, b, c, d) = map(int, sys.stdin.readline().split())
	(x, y, x1, y1, x2, y2) = map(int, sys.stdin.readline().split())
	xm = b - a
	ym = d - c
	if x + xm >= x1 and x + xm <= x2 and (y + ym >= y1) and (y + ym <= y2):
		nox = a == 0 and b == 0 and (xm == 0)
		noy = c == 0 and d == 0 and (ym == 0)
		if x2 - x1 == 0 and (not nox) or (y2 - y1 == 0 and (not noy)):
			print('No')
		else:
			print('Yes')
	else:
		print('No')


def run():
	t = int(input().strip())
	for _ in range(t):
		(a, b, c, d) = map(int, input().strip().split())
		(x, y, x1, y1, x2, y2) = map(int, input().strip().split())
		x3 = x - a + b
		y3 = y - c + d
		res = True
		if x3 < x1 or x3 > x2 or y3 < y1 or (y3 > y2):
			res = False
		elif x1 == x2 and (a > 0 or b > 0):
			res = False
		elif y1 == y2 and (c > 0 or d > 0):
			res = False
		print('Yes' if res else 'No')
run()


def check(df, loc):
	(a, b, c, d) = (df[0], df[1], df[2], df[3])
	(x0, y0, x1, y1, x2, y2) = (loc[0], loc[1], loc[2], loc[3], loc[4], loc[5])
	df_x = b - a
	df_y = d - c
	if x2 - x1 == 0 and (a != 0 or b != 0) or (y2 - y1 == 0 and (c != 0 or d != 0)):
		return 'No'
	if (x0 + df_x >= x1 and x0 + df_x <= x2) and (y0 + df_y >= y1 and y0 + df_y <= y2):
		return 'Yes'
	else:
		return 'No'
n = int(input())
while n > 0:
	df = [int(f) for f in input().split()]
	location = [int(f) for f in input().split()]
	print(check(df, location))
	n -= 1


testNumb = int(input())
for _ in range(testNumb):
	isPossible = True
	directions = [int(x) for x in input().split()]
	locations = [int(x) for x in input().split()]
	origin = [locations[0], locations[1]]
	limit_x = [locations[2], locations[4]]
	limit_y = [locations[3], locations[5]]
	range_x = limit_x[1] - limit_x[0]
	range_y = limit_y[1] - limit_y[0]
	distance_left = origin[0] - limit_x[0]
	distance_right = limit_x[1] - origin[0]
	distance_down = origin[1] - limit_y[0]
	distance_up = limit_y[1] - origin[1]
	if directions[0] - directions[1] > distance_left or directions[1] - directions[0] > distance_right or directions[2] - directions[3] > distance_down or (directions[3] - directions[2] > distance_up):
		isPossible = False
	if distance_left == 0 and distance_right == 0 and (directions[0] > 0 or directions[1] > 0):
		isPossible = False
	if distance_down == 0 and distance_up == 0 and (directions[2] > 0 or directions[3] > 0):
		isPossible = False
	if isPossible:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	X = 0
	Y = 0
	pl = abs(x1 - x)
	pr = abs(x2 - x)
	pd = abs(y1 - y)
	pu = abs(y2 - y)
	flag = 0
	if (c > 0 or pd > 0) and (y == y1 and y == y2):
		print('No')
	elif (a > 0 or b > 0) and (x == x1 and x == x2):
		print('No')
	elif pl >= a - b and pr >= b - a and (pd >= c - d) and (pu >= d - c):
		print('Yes')
	else:
		print('No')


def fun(l, r, up, d, u, v, x1, y1, x2, y2):
	horizontal = r - l
	vertical = up - d
	if x1 == x2 and (l != 0 or r != 0):
		return False
	if y1 == y2 and (up != 0 or d != 0):
		return False
	if u + horizontal > x2 or u + horizontal < x1:
		return False
	if v + vertical > y2 or v + vertical < y1:
		return False
	return True
for _ in range(int(input())):
	(l, r, d, up) = list(map(int, input().split()))
	(u, v, x1, y1, x2, y2) = list(map(int, input().split()))
	if fun(l, r, up, d, u, v, x1, y1, x2, y2):
		print('YES')
	else:
		print('NO')


from sys import stdin, stdout
from collections import defaultdict, Counter
from functools import lru_cache
from math import gcd, floor, ceil

def ilist():
	return [int(x) for x in stdin.readline().strip().split(' ')]

def iint():
	return int(stdin.readline().strip())

def istr():
	return stdin.readline().strip()

def pos(x, y):
	if x1 <= x <= x2 and y1 <= y <= y2:
		return True
	else:
		return False
t = iint()
for _x in range(t):
	(a, b, c, d) = ilist()
	(x, y, x1, y1, x2, y2) = ilist()
	p = True
	x += -a + b
	p = p and pos(x, y)
	y += -c + d
	p = p and pos(x, y)
	if x1 == x2 and (a != 0 or b != 0):
		p = False
	if y1 == y2 and (c != 0 or d != 0):
		p = False
	if p:
		print('YES')
	else:
		print('NO')


tc = int(input())
for cn in range(tc):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	if a + b > 0 and x1 == x2:
		print('No')
		continue
	if c + d > 0 and y1 == y2:
		print('No')
		continue
	m = min(a, b)
	a -= m
	b -= m
	m = min(c, d)
	c -= m
	d -= m
	if x - a >= x1 and x + b <= x2 and (y - c >= y1) and (y + d <= y2):
		print('Yes')
	else:
		print('No')


n = int(input())
for _ in range(n):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	flag = False
	flag2 = False
	if a > b:
		aa = x - (a - b)
		if x1 <= aa and aa <= x2:
			flag = True
	elif a < b:
		bb = x + (b - a)
		if x1 <= bb and bb <= x2:
			flag = True
	else:
		aa = x - 1
		bb = x + 1
		if a == 0:
			flag = True
		if x1 <= aa and aa <= x2:
			flag = True
		if x1 <= bb and bb <= x2:
			flag = True
	if flag:
		if c > d:
			cc = y - (c - d)
			if y1 <= cc and cc <= y2:
				flag2 = True
		elif c < d:
			dd = y + (d - c)
			if y1 <= dd and dd <= y2:
				flag2 = True
		else:
			cc = y - 1
			dd = y + 1
			if c == 0:
				flag2 = True
			if y1 <= cc and cc <= y2:
				flag2 = True
			if y1 <= dd and dd <= y2:
				flag2 = True
	if flag2:
		print('Yes')
	else:
		print('No')


t = int(input())
while t != 0:
	(l, r, d, u) = map(int, input().split())
	list1 = list(map(int, input().split()))
	p = r - l
	q = u - d
	if list1[0] == list1[2] == list1[4] and (l != 0 or r != 0) or (list1[1] == list1[3] == list1[5] and (u != 0 and d != 0)):
		print('No')
	elif list1[2] <= list1[0] + p <= list1[4]:
		if list1[3] <= list1[1] + q <= list1[5]:
			print('Yes')
		else:
			print('No')
	else:
		print('No')
	t -= 1


t = int(input())
for _ in range(t):
	(a, b, c, d) = list(map(int, input().split()))
	(x, y, x1, y1, x2, y2) = list(map(int, input().split()))
	p = 0
	if x1 == x2:
		if a == 0 and b == 0:
			pass
		else:
			p = p + 1
	if y1 == y2:
		if c == 0 and d == 0:
			pass
		else:
			p = p + 1
	if b > a:
		l = b - a
		if x + l > x2:
			p = p + 1
	else:
		l = a - b
		if x - l < x1:
			p = p + 1
	if d > c:
		l = d - c
		if y + l > y2:
			p = p + 1
	else:
		l = c - d
		if y - l < y1:
			p = p + 1
	if p == 0:
		print('Yes')
	else:
		print('No')


for _ in range(int(input())):
	(a, b, c, d) = input().split()
	(a, b, c, d) = (int(a), int(b), int(c), int(d))
	(x, y, x1, y1, x2, y2) = input().split()
	(x, y, x1, y1, x2, y2) = (int(x), int(y), int(x1), int(y1), int(x2), int(y2))
	h = b - a
	v = d - c
	if x1 == x2 and (a > 0 or b > 0):
		print('NO')
	elif y1 == y2 and (c > 0 or d > 0):
		print('NO')
	elif x + h >= x1 and x + h <= x2 and (y + v >= y1) and (y + v <= y2):
		print('YES')
	else:
		print('NO')


case_count = int(input())
for i in range(case_count):
	moves = [int(x) for x in input().split(' ')]
	dx = moves[1] - moves[0]
	dy = moves[3] - moves[2]
	pos = [int(x) for x in input().split(' ')]
	(x, y) = (pos[0], pos[1])
	(minx, miny, maxx, maxy) = (pos[2], pos[3], pos[4], pos[5])
	if minx > x + dx or maxx < x + dx:
		print('No')
		continue
	if miny > y + dy or maxy < y + dy:
		print('No')
		continue
	if x == minx and x == maxx and (moves[0] != 0 or moves[1] != 0):
		print('No')
		continue
	if (y == miny and y == maxy) and (moves[2] != 0 or moves[3] != 0):
		print('No')
		continue
	print('Yes')


for _ in range(int(input())):
	(a, b, c, d) = (int(x) for x in input().split())
	(x, y, x1, y1, x2, y2) = (int(x) for x in input().split())
	lr = b - a
	ud = d - c
	ans = 'Yes'
	if lr > 0 and x + lr > x2:
		ans = 'No'
	elif lr < 0 and x + lr < x1:
		ans = 'No'
	elif ud > 0 and y + ud > y2:
		ans = 'No'
	elif ud < 0 and y + ud < y1:
		ans = 'No'
	elif (a > 0 or b > 0) and x2 - x1 == 0:
		ans = 'No'
	elif (c > 0 or d > 0) and y2 - y1 == 0:
		ans = 'No'
	print(ans)


import sys
input = lambda : sys.stdin.readline().rstrip()

def zap():
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	cr1 = b - a
	cr2 = d - c
	if x + cr1 < x1 or x + cr1 > x2:
		return 'NO'
	if y + cr2 < y1 or y + cr2 > y2:
		return 'NO'
	if x1 == x2:
		if a != 0 or b != 0:
			return 'NO'
	if y1 == y2:
		if c != 0 and d != 0:
			return 'NO'
	return 'YES'
for _ in range(int(input())):
	print(zap())


import sys
input = sys.stdin.readline
t = int(input())
for r in range(t):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	flag1 = False
	flag2 = False
	temp1 = abs(b - a)
	temp2 = abs(c - d)
	if x == x1 and x == x2 and (a != 0 or b != 0) or (y == y1 and y == y2 and (c != 0 or d != 0)):
		print('No')
	else:
		if b > a:
			if temp1 <= abs(x - x2):
				flag1 = True
		elif temp1 <= abs(x - x1):
			flag1 = True
		if c > d:
			if temp2 <= abs(y - y1):
				flag2 = True
		elif temp2 <= abs(y - y2):
			flag2 = True
		if flag1 == True and flag2 == True:
			print('Yes')
		else:
			print('No')


def solve():
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	e = 0
	if x < x1 or x > x2:
		e = 1
	if y < y1 or y > y2:
		e = 1
	if e == 1:
		print('NO')
		return 0
	left = abs(x1 - x)
	right = abs(x - x2)
	down = abs(y1 - y)
	up = abs(y2 - y)
	if left == 0 and right == 0 and (a != 0 or b != 0):
		print('NO')
		return
	if up == 0 and down == 0 and (c != 0 and d != 0):
		print('NO')
		return
	if a - b > 0:
		p = a - b
	else:
		p = 0
	if b - a > 0:
		q = b - a
	else:
		q = 0
	if c - d > 0:
		r = c - d
	else:
		r = 0
	if d - c > 0:
		s = d - c
	else:
		s = 0
	if left >= p and right >= q and (down >= r) and (up >= s):
		print('YES')
	else:
		print('NO')
t = int(input())
for _ in range(t):
	solve()


t = int(input())
for _ in range(t):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	must_x = b - a
	must_y = d - c
	move_point = [x + must_x, y + must_y]
	if x1 == x2:
		if a != 0 or b != 0:
			print('No')
			continue
	if y1 == y2:
		if c != 0 or d != 0:
			print('No')
			continue
	if x1 <= move_point[0] <= x2 and y1 <= move_point[1] <= y2:
		print('Yes')
	else:
		print('No')


t = int(input())
for i in range(t):
	s = input().split()
	p = input().split()
	a = int(s[0])
	b = int(s[1])
	c = int(s[2])
	d = int(s[3])
	x = int(p[0])
	y = int(p[1])
	x1 = int(p[2])
	y1 = int(p[3])
	x2 = int(p[4])
	y2 = int(p[5])
	if x1 == x2 and x == x2 and (a != 0 or b != 0):
		print('No')
		continue
	if y1 == y2 and y == y2 and (c != 0 or d != 0):
		print('No')
		continue
	if x - x1 >= a - b and x2 - x >= b - a and (y - y1 >= c - d) and (y2 - y >= d - c):
		print('Yes')
	else:
		print('No')


for i in range(int(input())):
	(l, r, d, u) = map(int, input().split())
	l1 = list(map(int, input().split()))
	if l1[0] == l1[2] and l1[0] == l1[4]:
		if l == 0 and r == 0:
			tmp = 1
		else:
			print('NO')
			continue
	if l1[1] == l1[3] and l1[1] == l1[5]:
		if u == 0 and d == 0:
			tmp = 1
		else:
			print('NO')
			continue
	l1[0] -= l
	tr = 0
	t2 = 0
	l1[0] += r
	if l1[2] <= l1[0] and l1[0] <= l1[4]:
		t2 = 1
	else:
		tr = 1
	l1[1] -= d
	l1[1] += u
	if l1[3] <= l1[1] and l1[1] <= l1[5]:
		t2 = 1
	else:
		tr = 1
	if tr == 0:
		print('YES')
	else:
		print('NO')


from sys import stdin, stdout
t = int(stdin.readline())
for i in range(t):
	(a, b, c, d) = map(int, stdin.readline().split())
	(x, y, x1, y1, x2, y2) = map(int, stdin.readline().split())
	countx = False
	county = False
	if a >= b:
		left = x - x1
		if a == b == 0 or (a - b <= left and x2 - x1 > 0):
			countx = True
		else:
			countx = False
	else:
		right = x2 - x
		if a == b == 0 or (b - a <= right and x2 - x1 > 0):
			countx = True
		else:
			countx = False
	if c >= d:
		down = y - y1
		if c == d == 0 or (c - d <= down and y2 - y1 > 0):
			county = True
		else:
			county = False
	else:
		up = y2 - y
		if d - c <= up and y2 - y1 > 0 and (c > 0 or d > 0):
			county = True
		else:
			county = False
	if countx and county:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	(a, b, c, d) = list(map(int, input().split()))
	(x, y, x1, y1, x2, y2) = list(map(int, input().split()))
	if x1 == x and x1 == x2:
		if a > 0 or b > 0:
			print('NO')
			continue
	if y1 == y and y1 == y2:
		if d > 0 or c > 0:
			print('NO')
			continue
	xx = min(c, d)
	c -= xx
	d -= xx
	yy = min(a, b)
	a -= yy
	b -= yy
	if x - a >= x1 and x + b <= x2 and (y + d <= y2) and (y - c >= y1):
		print('YES')
	else:
		print('NO')


import sys
with sys.stdin as fin:
	test_cases = int(fin.readline())
	for t in range(test_cases):
		walk = [int(i) for i in fin.readline().rstrip().split()]
		boundaries = [int(i) for i in fin.readline().rstrip().split()]
		if (walk[0] > 0 or walk[1] > 0) and boundaries[2] == boundaries[4]:
			print('NO')
			continue
		if (walk[2] > 0 or walk[3] > 0) and boundaries[3] == boundaries[5]:
			print('NO')
			continue
		r = walk[1] - walk[0] + boundaries[0]
		u = boundaries[1] + walk[3] - walk[2]
		if r >= boundaries[2] and r <= boundaries[4] and (u >= boundaries[3]) and (u <= boundaries[5]):
			print('YES')
		else:
			print('NO')


T = int(input())
while T:
	T -= 1
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	a -= b
	c -= d
	x -= a
	y -= c
	if a + b and x1 == x2 or (c + d and y1 == y2) or (x < x1 or x > x2 or y < y1 or (y > y2)):
		print('No')
	else:
		print('Yes')


import sys
import os
from io import IOBase, BytesIO
import math
mod = 10 ** 9 + 7
pie = 3.1415926536

def modinv(n, p):
	return pow(n, p - 2, p)

def ncr(n, r, p):
	t = fact[n] * (ifact[r] * ifact[n - r] % p) % p
	return t

def ain():
	return list(map(int, sin().split()))

def sin():
	return input().strip()

def GCD(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def read2DIntArray(row, col):
	arr = []
	for i in range(0, row):
		temp = list(map(int, sin().split()))
		arr.append(temp)
	return arr

def read2DCharArray(row, col):
	arr = []
	for i in range(0, row):
		temp = str(sin())
		arr.append(temp)
	return arr

def smallestNumber(n):
	lst = list(str(n))
	lst.sort()
	tmp = ''
	for (i, n) in enumerate(lst):
		if n != '0':
			tmp = lst.pop(i)
			break
	return str(tmp) + ''.join(lst)

def SieveOfEratosthenes(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 1
	prime[0] = False
	prime[1] = False
	lst = []
	for p in range(n + 1):
		if prime[p]:
			lst.append(p)
	return lst

def nCr(n, r):
	a = 1
	b = 1
	c = 1
	for i in range(1, n + 1):
		c *= i
	for i in range(1, r + 1):
		b *= i
	for i in range(1, n - r + 1):
		a *= i
	return c // (a * b)

def sieveOfEratosthenes1(N, s):
	prime = [False] * (N + 1)
	for i in range(2, N + 1, 2):
		s[i] = 2
	for i in range(3, N + 1, 2):
		if prime[i] == False:
			s[i] = i
			for j in range(i, int(N / i) + 1, 2):
				if prime[i * j] == False:
					prime[i * j] = True
					s[i * j] = i

def generatePrimeFactors(N):
	s = [0] * (N + 1)
	sieveOfEratosthenes1(N, s)
	curr = s[N]
	cnt = 1
	factors = []
	power = []
	while N > 1:
		N //= s[N]
		if curr == s[N]:
			cnt += 1
			continue
		factors.append(curr)
		power.append(cnt)
		curr = s[N]
		cnt = 1
	return (factors, power)

def main():
	for _ in range(int(sin())):
		(a, b, c, d) = map(int, sin().split())
		(x, y, x1, y1, x2, y2) = map(int, sin().split())
		f = 0
		if x != x1 or x != x2:
			tmp = min(a, b)
			a -= tmp
			b -= tmp
		if y != y1 or y != y2:
			tmp = min(c, d)
			c -= tmp
			d -= tmp
		if a > 0 and x - a < x1 or (b > 0 and x + b > x2) or (c > 0 and y - c < y1) or (d > 0 and y + d > y2):
			f = 1
		if f == 0:
			print('yes')
		else:
			print('no')
py2 = round(0.5)
if py2:
	from future_builtins import ascii, filter, hex, map, oct, zip
	range = xrange
BUFSIZE = 8192

class FastIO(BytesIO):
	newlines = 0

	def __init__(self, file):
		self._file = file
		self._fd = file.fileno()
		self.writable = 'x' in file.mode or 'w' in file.mode
		self.write = super(FastIO, self).write if self.writable else None

	def _fill(self):
		s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
		self.seek((self.tell(), self.seek(0, 2), super(FastIO, self).write(s))[0])
		return s

	def read(self):
		while self._fill():
			pass
		return super(FastIO, self).read()

	def readline(self):
		while self.newlines == 0:
			s = self._fill()
			self.newlines = s.count(b'\n') + (not s)
		self.newlines -= 1
		return super(FastIO, self).readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.getvalue())
			(self.truncate(0), self.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		if py2:
			self.write = self.buffer.write
			self.read = self.buffer.read
			self.readline = self.buffer.readline
		else:
			self.write = lambda s: self.buffer.write(s.encode('ascii'))
			self.read = lambda : self.buffer.read().decode('ascii')
			self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))

def input():
	return sys.stdin.readline().rstrip('\r\n')
main()


for _testcases_ in range(int(input())):
	li = list(map(int, input().split()))
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	boo = False
	u = x + (li[1] - li[0])
	umax = x + li[1]
	umin = x - li[0]
	vmax = y + li[3]
	vmin = y - li[2]
	v = y + (li[3] - li[2])
	if u <= x2 and u >= x1 and (v >= y1) and (v <= y2):
		boo = True
	if x2 - x1 == 0:
		if li[0] != 0 and li[1] != 0:
			boo = False
	if y2 - y1 == 0 and vmax != v:
		if li[2] != 0 and li[3] != 0:
			boo = False
	if boo:
		print('Yes')
	else:
		print('No')


from sys import stdin, stdout
from math import *
from heapq import *
from collections import *

def main():
	ntest = int(stdin.readline())
	for ncase in range(ntest):
		(a, b, c, d) = [int(x) for x in stdin.readline().split()]
		(x, y, x1, y1, x2, y2) = [int(x) for x in stdin.readline().split()]
		try:
			if x1 == x2:
				assert a == 0 and b == 0
			if y1 == y2:
				assert c == 0 and d == 0
			x = x - a + b
			y = y - c + d
			assert x1 <= x and x <= x2 and (y1 <= y) and (y <= y2)
			stdout.write('YES\n')
		except:
			stdout.write('NO\n')
	return 0
main()


T = int(input(''))
matrixa = []
matrixb = []
for i in range(T):
	inp1 = input('')
	inp2 = input('')
	raw = inp1.split()
	matrixa.append(raw)
	raw2 = inp2.split()
	matrixb.append(raw2)
for i in range(T):
	a = int(matrixa[i][0])
	b = int(matrixa[i][1])
	c = int(matrixa[i][2])
	d = int(matrixa[i][3])
	x = int(matrixb[i][0])
	y = int(matrixb[i][1])
	x1 = int(matrixb[i][2])
	y1 = int(matrixb[i][3])
	x2 = int(matrixb[i][4])
	y2 = int(matrixb[i][5])
	fx = x + (b - a)
	fy = y + (d - c)
	if x1 < x2:
		fx1 = x1
		fx2 = x2
	else:
		fx1 = x2
		fx2 = x1
	if y1 < y2:
		fy1 = y1
		fy2 = y2
	else:
		fy1 = y2
		fy2 = y1
	if fx1 <= fx <= fx2 and fy1 <= fy <= fy2:
		if a + b > 0 and x1 == x2:
			print('NO')
		elif c + d > 0 and y1 == y2:
			print('NO')
		else:
			print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	rx1 = x - x1
	rx2 = x - x2
	ry1 = y - y1
	ry2 = y - y2
	dx = a - b
	if a == b and a != 0:
		dx = 1 if rx1 else -1
	dy = c - d
	if c == d and c != 0:
		dy = 1 if ry1 else -1
	if rx1 >= dx >= rx2 and ry1 >= dy >= ry2:
		print('Yes')
	else:
		print('No')


q = int(input())
for w in range(q):
	f = 1
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	xa = max(a, b) - min(a, b)
	ya = max(c, d) - min(c, d)
	if a > b:
		if x - xa < x1:
			f = 0
	elif x + xa > x2:
		f = 0
	if c > d:
		if y - ya < y1:
			f = 0
	elif y + ya > y2:
		f = 0
	if x1 - x2 == 0 and (a > 0 or b > 0):
		f = 0
	if y1 - y2 == 0 and (c > 0 or d > 0):
		f = 0
	if f == 1:
		print('Yes')
	else:
		print('No')


pp = int(input(''))
for i in range(pp):
	(l, r, u, d) = map(int, input('').split())
	(p0, p1, lr, ll, lu, ld) = map(int, input('').split())
	wl = [r, l]
	ud = [u, d]
	ll1 = [lr, lu]
	ll2 = [ll, ld]
	if p0 == p1 == lr == ld == lu == ll or ll > ld or lr > lu:
		print('no')
	elif p1 == ll == ld and (u or d != 0):
		print('no')
	elif p0 == lr == lu and (l or r != 0):
		print('no')
	elif max(wl) == r:
		if abs(r - l) + p0 <= max(ll1):
			if max(ud) == u:
				if -1 * (u - d) + p1 >= min(ll2):
					print('yes')
				else:
					print('no')
			elif abs(u - d) + p1 <= max(ll2):
				print('yes')
			else:
				print('no')
		else:
			print('no')
	elif -1 * (l - r) + p0 >= min(ll1):
		if max(ud) == u:
			if -1 * (u - d) + p1 >= min(ll2):
				print('yes')
			else:
				print('no')
		elif abs(u - d) + p1 <= max(ll2):
			print('yes')
		else:
			print('no')
	else:
		print('no')


import sys
import math
from collections import defaultdict
import bisect
import random

def alele():
	return list(map(int, sys.stdin.readline().strip().split()))

def ilele():
	return map(int, sys.stdin.readline().strip().split())

def input():
	return sys.stdin.readline().strip()

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]

def Yes():
	print('Yes')

def No():
	print('No')

def YES():
	print('YES')

def NO():
	print('NO')
INF = 10 ** 18
MOD = 1000000000 + 7
for _ in range(int(input())):
	(a, b, c, d) = ilele()
	(x, y, x1, y1, x2, y2) = ilele()
	b -= a
	d -= c
	if x1 == x2 and (a or b):
		print('No')
		continue
	if y1 == y2 and (c or d):
		print('No')
		continue
	x += b
	y += d
	if x > x2 or x < x1:
		print('No')
		continue
	if y > y2 or y < y1:
		print('No')
		continue
	print('Yes')


t = int(input())
for i in range(t):
	abcd = list(map(int, input().split()))
	xys = list(map(int, input().split()))
	a = abcd[0]
	b = abcd[1]
	c = abcd[2]
	d = abcd[3]
	startx = xys[0]
	starty = xys[1]
	xleft = xys[2]
	ydown = xys[3]
	xright = xys[4]
	yup = xys[5]
	varianceLR = b - a
	varianceUD = d - c
	if ydown == yup and (c or d):
		print('NO')
	elif xleft == xright and (a or b):
		print('NO')
	elif xleft <= startx + varianceLR <= xright and ydown <= starty + varianceUD <= yup:
		print('YES')
	else:
		print('NO')


for _ in ' ' * int(input()):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	n = 0
	if x == x1 == x2 and a + b != 0:
		print('no')
	elif y == y1 == y2 and c + d != 0:
		print('no')
	else:
		print('yes' if x1 <= x - a + b <= x2 and y1 <= y - c + d <= y2 else 'no')


t = int(input())
for _ in range(t):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	x3 = b - a
	y3 = d - c
	fudeux1 = 0
	fudeux2 = 0
	fudeuy1 = 0
	fudeuy2 = 0
	fudeu_de_vez = 0
	if x == x1:
		if a > 0:
			fudeux1 = 1
	if x == x2:
		if b > 0:
			fudeux2 = 1
	if y == y1:
		if c > 0:
			fudeuy1 = 1
	if y == y2:
		if d > 0:
			fudeuy2 = 1
	if fudeux1:
		if fudeux2:
			fudeu_de_vez = 1
		elif x + x3 > x2:
			fudeu_de_vez = 1
	if fudeux2:
		if fudeux1:
			fudeu_de_vez = 1
		elif x + x3 < x1:
			fudeu_de_vez = 1
	if fudeuy1:
		if fudeuy2:
			fudeu_de_vez = 1
		elif y + y3 > y2:
			fudeu_de_vez = 1
	if fudeuy2:
		if fudeuy1:
			fudeu_de_vez = 1
		elif y + y3 < y1:
			fudeu_de_vez = 1
	if fudeu_de_vez == 0:
		if x3 > 0:
			if x + x3 > x2:
				fudeu_de_vez = 1
		if x3 < 0:
			if x + x3 < x1:
				fudeu_de_vez = 1
		if y3 > 0:
			if y + y3 > y2:
				fudeu_de_vez = 1
		if y3 < 0:
			if y + y3 < y1:
				fudeu_de_vez = 1
	if fudeu_de_vez:
		print('NO')
	else:
		print('YES')


def main():
	t = int(input())
	while t:
		(a, b, c, d) = map(int, input().split())
		(x, y, x1, y1, x2, y2) = map(int, input().split())
		xf = x + b - a
		yf = y + d - c
		length = abs(x2 - x1)
		width = abs(y2 - y1)
		if length <= 0 and width <= 0:
			print('No')
		elif x1 == x2 and (a != 0 or b != 0):
			print('No')
		elif y1 == y2 and (c != 0 or d != 0):
			print('No')
		elif xf > max(x1, x2):
			print('No')
		elif xf < min(x1, x2):
			print('No')
		elif yf < min(y1, y2):
			print('No')
		elif yf > max(y1, y2):
			print('No')
		else:
			print('Yes')
		t -= 1
main()


from math import ceil, sqrt, log, gcd

def ii():
	return int(input())

def si():
	return input()

def mi():
	return map(int, input().split())

def li():
	return list(mi())

def isprime(n):
	for i in range(2, int(sqrt(n)) + 1):
		if n % i == 0:
			return 0
	return 1

def main():
	for _ in range(ii()):
		(a, b, c, d) = mi()
		(x, y, x1, y1, x2, y2) = mi()
		a1 = a - b
		a2 = c - d
		f = 0
		f1 = 0
		x -= a1
		y -= a2
		if (x >= x1 and x <= x2) and (y >= y1 and y <= y2):
			if (a > 0 and x - 1 < x1) and (b > 0 and x + 1 > x2):
				f = 1
			elif (c > 0 and y - 1 < y1) and (d > 0 and y + 1 > y2):
				f1 = 1
			if f or f1:
				print('NO')
			else:
				print('YES')
		else:
			print('NO')
main()


t = int(input())
for i in range(t):
	out = 'NO'
	(a, b, c, d) = list(map(int, input().split()))
	(x, y, x1, y1, x2, y2) = list(map(int, input().split()))
	temp1 = x - a + b
	temp2 = y - c + d
	if temp1 >= x1 and temp1 <= x2 and (temp2 >= y1) and (temp2 <= y2):
		out = 'YES'
	if (a != 0 or b != 0) and x2 == x1 or ((c != 0 or d != 0) and y1 == y2):
		out = 'NO'
	print(out)


t = int(input())
for i in range(t):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	a1 = x - x1
	flag = True
	c1 = y - y1
	if a - a1 < 0:
		x = x - a
		a = 0
		if x + b <= x2:
			flag = flag and True
		else:
			flag = False
	else:
		a -= a1
		x = x1
		if b == 0:
			if a != 0:
				flag = False
			else:
				flag = flag and True
		elif x1 + b - a <= x2 and x1 + 1 <= x2 and (b - a >= 0):
			flag = flag and True
		else:
			flag = False
		flag = flag and True
	if c - c1 < 0:
		y = y - c
		c = 0
		if y + d <= y2:
			flag = flag and True
		else:
			flag = False
		flag = flag and True
	else:
		c -= c1
		y = y1
		if d == 0:
			if c == 0:
				flag = flag and True
			else:
				flag = False
		elif y1 + d - c <= y2 and y1 + 1 <= y2 and (d - c >= 0):
			flag = flag and True
		else:
			flag = False
	if flag:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	(a, b, c, d) = tuple(map(int, input().split()))
	(x, y, x1, y1, x2, y2) = tuple(map(int, input().split()))
	x1 = x1 - x
	x2 = x2 - x
	x = 0
	y1 = y1 - y
	y2 = y2 - y
	y = 0
	if x2 >= b - a and abs(x1) >= -b + a and (y2 >= d - c) and (abs(y1) >= -d + c):
		if x1 == x2 and (a != 0 or b != 0):
			print('NO')
		elif y1 == y2 and (c != 0 or d != 0):
			print('NO')
		else:
			print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	l = list(map(int, input().split()))
	f = True
	if l[0] == l[2] and l[0] == l[4]:
		if a or b:
			f = False
	if l[1] == l[3] and l[1] == l[5]:
		if c or d:
			f = False
	if f == False:
		print('No')
	elif l[0] + (-1 * a + b) < l[2] or l[0] + (-1 * a + b) > l[4] or l[1] + (-1 * c + d) < l[3] or (l[1] + (-1 * c + d) > l[5]):
		print('No')
	else:
		print('Yes')


t = int(input())
for _ in range(t):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	g = 1 if x >= x1 and x <= x2 and (y >= y1) and (y <= y2) else 0
	f = 1 if (x + min(1, b) >= x1 and x + min(1, b) <= x2 or (x - min(1, a) >= x1 and x - min(1, a) <= x2)) and (y + min(1, d) >= y1 and y + min(1, d) <= y2 or (y - min(1, c) >= y1 and y - min(1, c) <= y2)) else 0
	if b >= a:
		x += b - a
	else:
		x -= a - b
	if d >= c:
		y += d - c
	else:
		y -= c - d
	if x >= x1 and x <= x2 and (y >= y1) and (y <= y2) and f and g:
		print('Yes')
	else:
		print('No')


def in_bound():
	pass
testcases = int(input(''))
results = []
for i in range(testcases):
	(a, b, c, d) = [int(x) for x in str(input('')).split(' ')]
	(x, y, x1, y1, x2, y2) = [int(x) for x in str(input('')).split(' ')]
	start = False
	horiz = False
	vert = False
	move = False
	x_ax = x - a + b
	y_ay = y - c + d
	if x_ax >= x1 and x_ax <= x2:
		horiz = True
	else:
		horiz = False
	if y_ay >= y1 and y_ay <= y2:
		vert = True
	else:
		vert = False
	if x >= x1 and x <= x2 and (y >= y1) and (y <= y2):
		start = True
	else:
		start = False
	if x1 == x2 and (a != 0 or b != 0):
		move = False
	elif y1 == y2 and (c != 0 or d != 0):
		move = False
	else:
		move = True
	if horiz == True and vert == True and (start == True) and (move == True):
		results.append('Yes')
	else:
		results.append('No')
for res in results:
	print(res)


n = int(input())
(a, b, c, d, x, y, x1, y1, x2, y2) = ([], [], [], [], [], [], [], [], [], [])
for i in range(0, n):
	a.append(0)
	b.append(0)
	c.append(0)
	d.append(0)
	x.append(0)
	y.append(0)
	x1.append(0)
	y1.append(0)
	x2.append(0)
	y2.append(0)
for j in range(0, n):
	(a[j], b[j], c[j], d[j]) = input().split()
	(x[j], y[j], x1[j], y1[j], x2[j], y2[j]) = input().split()
	a[j] = int(a[j])
	b[j] = int(b[j])
	c[j] = int(c[j])
	d[j] = int(d[j])
	x[j] = int(x[j])
	y[j] = int(y[j])
	x1[j] = int(x1[j])
	y1[j] = int(y1[j])
	x2[j] = int(x2[j])
	y2[j] = int(y2[j])
for z in range(0, n):
	right = b[z] - a[z]
	up = d[z] - c[z]
	if x2[z] - x1[z] == 0 and (a[z] != 0 or b[z] != 0):
		print('No')
	elif y2[z] - y1[z] == 0 and (c[z] != 0 or d[z] != 0):
		print('No')
	elif x[z] + right > x2[z] or x[z] + right < x1[z]:
		print('No')
	elif y[z] + up > y2[z] or y[z] + up < y1[z]:
		print('No')
	else:
		print('Yes')


def can(a, b, c, d, x, y, x1, y1, x2, y2):
	if x1 == x2:
		if a != 0 or b != 0:
			return False
	if y1 == y2:
		if c != 0 or d != 0:
			return False
	move = min(a, b)
	a -= move
	b -= move
	move = min(c, d)
	c -= move
	d -= move
	if x - a > x1:
		move = a
	else:
		move = x - x1
	if x - a > x1:
		move = a
	else:
		move = x - x1
	x -= move
	a -= move
	if y - c > y1:
		move = c
	else:
		move = x - y1
	y -= move
	c -= move
	d_x = x2 - x1
	d_y = y2 - y1
	if b > d_x + a - x + x1:
		return False
	if d > d_y + c - y + y1:
		return False
	if x + b < x2:
		move = b
	else:
		move = x2 - x
	x += move
	b -= move
	if y + d < y2:
		move = d
	else:
		move = y2 - y
	y += move
	d -= move
	if a > d_x + b - x2 + x:
		return False
	if c > d_y + d - y2 + y:
		return False
	return True
t = int(input())
while t > 0:
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	if can(a, b, c, d, x, y, x1, y1, x2, y2) == True:
		print('YES')
	else:
		print('NO')
	t -= 1


def check(a, b, s, l, r):
	if a + b == 0:
		return 1
	if l == r:
		return 0
	if l <= s - a + b <= r:
		return 1
	return 0
T = int(input())
for _ in range(T):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	print('YES' if check(a, b, x, x1, x2) and check(c, d, y, y1, y2) else 'NO')


import sys

def input():
	return sys.stdin.readline()[:-1]
t = int(input())
for _ in range(t):
	(a, b, c, d) = [int(x) for x in input().split()]
	(x, y, x1, y1, x2, y2) = [int(x) for x in input().split()]
	if x1 == x2 and (a or b) or (y1 == y2 and (c or d)):
		print('NO')
		continue
	x += b - a
	y += d - c
	if x >= x1 and x <= x2 and (y >= y1) and (y <= y2):
		print('YES')
	else:
		print('NO')


t = int(input())

def able(x1, x2, x, dx):
	return x1 <= x + dx <= x2

def solve(x1, x, x2, a, b):
	dx = b - a
	if x2 - x >= 1 or x - x1 >= 1:
		return able(x1, x2, x, dx)
	else:
		if a + b == 0:
			return True
		return False
ans = list()
for tt in range(0, t):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	if solve(x1, x, x2, a, b) and solve(y1, y, y2, c, d):
		ans.append('yes')
	else:
		ans.append('no')
for x in ans:
	print(x)


for _ in range(int(input())):
	(l, r, d, u) = list(map(int, input().split()))
	pos = list(map(int, input().split()))
	x = pos[0]
	y = pos[1]
	x1 = pos[2]
	y1 = pos[3]
	x2 = pos[4]
	y2 = pos[5]
	ch = 0
	if x1 == x2 == x and r != 0:
		ch = 1
	if y1 == y2 == y and u != 0:
		ch = 1
	if x1 == x2 == x and l != 0:
		ch = 1
	if y1 == y2 == y and d != 0:
		ch = 1
	if x1 <= x + (r - l) <= x2:
		ch = ch
	else:
		ch = 1
	if y1 <= y + (u - d) <= y2:
		ch = ch
	else:
		ch = 1
	if ch == 0:
		print('YES')
	else:
		print('NO')


T = int(input())
for _ in range(T):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	A = b - a
	B = d - c
	flag = 0
	if B == 0 and d != 0:
		if not y1 <= y - 1 <= y2 and (not y1 <= y + 1 <= y2):
			flag = 1
	if A == 0 and a != 0:
		if not x1 <= x - 1 <= x2 and (not x1 <= x + 1 <= x2):
			flag = 1
	if x1 <= x + A <= x2 and y1 <= y + B <= y2 and (flag == 0):
		print('Yes')
	else:
		print('No')


import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub
sys.setrecursionlimit(100000)
input = sys.stdin.readline
INF = 2 ** 62 - 1

def read_int():
	return int(input())

def read_int_n():
	return list(map(int, input().split()))

def read_float():
	return float(input())

def read_float_n():
	return list(map(float, input().split()))

def read_str():
	return input().strip()

def read_str_n():
	return list(map(str, input().split()))

def error_print(*args):
	print(*args, file=sys.stderr)

def mt(f):
	import time

	def wrap(*args, **kwargs):
		s = time.time()
		ret = f(*args, **kwargs)
		e = time.time()
		error_print(e - s, 'sec')
		return ret
	return wrap

def slv(A, B, C, D, X, Y, X1, Y1, X2, Y2):
	X1 -= X
	X2 -= X
	Y1 -= Y
	Y2 -= Y
	if A == 0 and B == 0:
		pass
	elif not X1 <= B - A <= X2:
		return 'No'
	elif X1 == X2:
		return 'No'
	if C == 0 and D == 0:
		pass
	elif not Y1 <= D - C <= Y2:
		return 'No'
	elif Y1 == Y2:
		return 'No'
	return 'Yes'

def main():
	T = read_int()
	for _ in range(T):
		(A, B, C, D) = read_int_n()
		(X, Y, X1, Y1, X2, Y2) = read_int_n()
		print(slv(A, B, C, D, X, Y, X1, Y1, X2, Y2))
main()


t = int(input())
for i in range(1, t + 1):
	(a, b, c, d) = map(int, input().split())
	(cx, cy, lxl, lyd, lxr, lyu) = map(int, input().split())
	if cx == lxl and cx == lxr:
		if a > 0 or b > 0:
			print('No')
			continue
	if cy == lyd and cy == lyu:
		if c > 0 or d > 0:
			print('No')
			continue
	if a > b:
		if cx + b - a < lxl:
			print('No')
			continue
	elif b > a:
		if cx + b - a > lxr:
			print('No')
			continue
	if c > d:
		if cy + d - c < lyd:
			print('No')
			continue
	elif d > c:
		if cy + d - c > lyu:
			print('No')
			continue
	print('Yes')


from sys import stdin, stdout
import math, sys
from itertools import permutations, combinations
from collections import defaultdict, deque
import bisect as bi

def I():
	return int(input())

def In():
	return map(int, input().split())

def main():
	try:
		for _ in range(I()):
			(a, b, c, d) = In()
			(x, y, x1, y1, x2, y2) = In()
			(q1, q2) = (0, 0)
			if abs(a) > abs(b):
				t1 = abs(b - a)
				if t1 > abs(x1 - x):
					q1 = 1
				if x1 == x2:
					if a == 0 and b == 0:
						q1 = 0
					else:
						q1 = 1
			else:
				t1 = abs(b - a)
				if t1 > abs(x2 - x):
					q1 = 1
				if x1 == x2:
					if a == 0 and b == 0:
						q1 = 0
					else:
						q1 = 1
			if abs(c) > abs(d):
				t1 = abs(c - d)
				if t1 > abs(y - y1):
					q2 = 1
				if y1 == y2:
					if c == 0 and d == 0:
						q2 = 0
					else:
						q2 = 1
			else:
				t1 = abs(d - c)
				if t1 > abs(y2 - y):
					q2 = 1
				if y1 == y2:
					if c == 0 and d == 0:
						q2 = 0
					else:
						q2 = 1
			if q1 == 0 and q2 == 0:
				print('Yes')
			else:
				print('No')
	except:
		pass
M = 998244353
P = 1000000007
main()


t = int(input())
for i in range(t):
	(a, b, c, d) = map(int, input().split())
	(x, y, e, f, g, h) = map(int, input().split())
	if g - e == 0 and a * b != 0 or (h - f == 0 and c * d != 0):
		print('NO')
	elif x - e >= a - b and g - x >= b - a and (y - f >= c - d) and (h - y >= d - c):
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	possible = True
	d_x = b - a
	d_y = d - c
	if x1 == x2:
		if a > 0 or b > 0:
			possible = False
	if y1 == y2:
		if c > 0 or d > 0:
			possible = False
	if d_x < 0:
		if x - x1 < abs(d_x):
			possible = False
	if d_x > 0:
		if x2 - x < abs(d_x):
			possible = False
	if d_y < 0:
		if y - y1 < abs(d_y):
			possible = False
	if d_y > 0:
		if y2 - y < abs(d_y):
			possible = False
	if possible:
		print('Yes')
	else:
		print('No')


import re

def solve(a, b, c, d, x, y, x1, y1, x2, y2):
	if x1 == x and x == x2:
		if a or b:
			return 'nO'
	if y1 == y and y2 == y:
		if c or d:
			return 'no'
	if a > b:
		if x - (a - b) < x1:
			return 'nO'
	if a < b:
		if x + (b - a) > x2:
			return 'No'
	if c > d:
		if y - (c - d) < y1:
			return 'NO'
	if c < d:
		if y + (d - c) > y2:
			return 'no'
	return 'yEs'
tests = int(input())
for test in range(1, tests + 1):
	(a, b, c, d) = list(map(int, input().split()))
	(x, y, x1, y1, x2, y2) = list(map(int, input().split()))
	print(solve(a, b, c, d, x, y, x1, y1, x2, y2))


import math

def rMap():
	return map(int, input().split())

def rList():
	return list(map(int, input().split()))
t = int(input())
for i in range(t):
	(a, b, c, d) = rMap()
	(x, y, x1, y1, x2, y2) = rMap()
	boo = True
	if x == x1 == x2 and (a > 0 or b > 0):
		boo = False
	elif y == y1 == y2 and (c > 0 or d > 0):
		boo = False
	if a > b:
		if a - b > x - x1:
			boo = False
	elif b - a > x2 - x:
		boo = False
	if c > d:
		if c - d > y - y1:
			boo = False
	elif d - c > y2 - y:
		boo = False
	print('Yes' if boo else 'No')


t = int(input())
for tc in range(t):
	s1 = input().split()
	(a, b, c, d) = (int(s1[0]), int(s1[1]), int(s1[2]), int(s1[3]))
	s2 = input().split()
	f1 = 0
	(x, y, x1, y1, x2, y2) = (int(s2[0]), int(s2[1]), int(s2[2]), int(s2[3]), int(s2[4]), int(s2[5]))
	if (x1 == x and x2 == x) and (a > 0 or b > 0):
		print('NO')
		f1 = 1
	elif (y1 == y and y2 == y) and (c > 0 or d > 0):
		print('NO')
		f1 = 1
	elif x == x1 and a > b:
		print('NO')
		f1 = 1
	elif x == x2 and a < b:
		print('NO')
		f1 = 1
	elif y == y1 and c > d:
		print('NO')
		f1 = 1
	elif y == y2 and c < d:
		print('NO')
		f1 = 1
	a = -a
	c = -c
	e = min(abs(a), b)
	a += e
	b -= e
	f = min(abs(c), d)
	c += f
	d -= f
	m1 = a + b + x
	m2 = c + d + y
	if f1 == 0:
		if (m1 >= x1 and m1 <= x2) and (m2 >= y1 and m2 <= y2):
			print('YES')
		else:
			print('NO')


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
testcases = int(input())
for j in range(testcases):
	values = list(map(int, input().split()))
	l = values[0]
	r = values[1]
	d = values[2]
	u = values[3]
	coords = list(map(int, input().split()))
	(x, y) = (coords[0], coords[1])
	(x1, y1) = (coords[2], coords[3])
	(x2, y2) = (coords[4], coords[5])
	alpha = 0
	if l == r:
		if x == x1 == x2 and l != 0:
			alpha += 0
		else:
			alpha += 1
	elif l > r:
		if x - (l - r) < x1:
			alpha += 0
		else:
			alpha += 1
	elif r > l:
		if x + (r - l) > x2:
			alpha += 0
		else:
			alpha += 1
	if u == d:
		if y == y1 == y2 and u != 0:
			alpha += 0
		else:
			alpha += 1
	elif d > u:
		if y - (d - u) < y1:
			alpha += 0
		else:
			alpha += 1
	elif u > d:
		if y + (u - d) > y2:
			alpha += 0
		else:
			alpha += 1
	if alpha == 2:
		print('Yes')
	else:
		print('No')


import sys
tc = int(sys.stdin.readline())
for _ in range(tc):
	(left, right, down, up) = map(int, sys.stdin.readline().split())
	(x, y, x1, y1, x2, y2) = map(int, sys.stdin.readline().split())
	vertical = True
	horizontal = True
	temp = min(left, right)
	if temp > 0 and x1 == x and (x2 == x):
		horizontal = False
	left -= temp
	right -= temp
	temp = min(down, up)
	if temp > 0 and y1 == y and (y2 == y):
		vertical = False
	down -= temp
	up -= temp
	if left and (not right):
		x -= left
	else:
		x += right
	if down and (not up):
		y -= down
	else:
		y += up
	print('YES' if vertical and horizontal and (x1 <= x <= x2) and (y1 <= y <= y2) else 'NO')


t = int(input())
for i in range(t):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	fin_x = -a + b
	fin_y = -c + d
	x += fin_x
	y += fin_y
	if a + b > 0 and x1 == x2:
		print('NO')
	elif c + d > 0 and y1 == y2:
		print('NO')
	elif (x >= x1 and x <= x2) and (y >= y1 and y <= y2):
		print('YES')
	else:
		print('NO')


import sys
import math
import itertools
import functools
import collections
import operator
import fileinput
import copy
ORDA = 97

def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return [int(i) for i in input().split()]

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)

def revn(n):
	return str(n)[::-1]

def dd():
	return collections.defaultdict(int)

def ddl():
	return collections.defaultdict(list)

def sieve(n):
	if n < 2:
		return list()
	prime = [True for _ in range(n + 1)]
	p = 3
	while p * p <= n:
		if prime[p]:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 2
	r = [2]
	for p in range(3, n + 1, 2):
		if prime[p]:
			r.append(p)
	return r

def divs(n, start=2):
	r = []
	for i in range(start, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n / i == i:
				r.append(i)
			else:
				r.extend([i, n // i])
	return r

def divn(n, primes):
	divs_number = 1
	for i in primes:
		if n == 1:
			return divs_number
		t = 1
		while n % i == 0:
			t += 1
			n //= i
		divs_number *= t

def prime(n):
	if n == 2:
		return True
	if n % 2 == 0 or n <= 1:
		return False
	sqr = int(math.sqrt(n)) + 1
	for d in range(3, sqr, 2):
		if n % d == 0:
			return False
	return True

def convn(number, base):
	new_number = 0
	while number > 0:
		new_number += number % base
		number //= base
	return new_number

def cdiv(n, k):
	return n // k + (n % k != 0)

def ispal(s):
	for i in range(len(s) // 2 + 1):
		if s[i] != s[-i - 1]:
			return False
	return True
for i in range(ii()):
	(l, r, d, u) = mi()
	(x, y, xl, yd, xr, yu) = mi()
	ans = 1
	if r - l > xr - x or l - r > x - xl:
		ans = 0
	if d - u > y - yd or u - d > yu - y:
		ans = 0
	if xl == xr and l + r > 0:
		ans = 0
	if yd == yu and u + d > 0:
		ans = 0
	if ans:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	if x != x1 or x != x2:
		temp = min(a, b)
		a -= temp
		b -= temp
	if y != y1 or y != y2:
		temp = min(c, d)
		c -= temp
		d -= temp
	flag = 0
	if a > 0:
		if x - a < x1:
			flag = 1
	if b > 0:
		if x + b > x2:
			flag = 1
	if c > 0:
		if y - c < y1:
			flag = 1
	if d > 0:
		if y + d > y2:
			flag = 1
	if flag:
		print('No')
	else:
		print('Yes')


t = int(input())
while t > 0:
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	flag = 'YES'
	(xd, yd) = (abs(a - b), abs(c - d))
	if a == b and x == x1 == x2 and (a != 0) or (a > b and x - x1 < xd) or (a < b and x2 - x < xd):
		flag = 'NO'
	if c == d and y == y1 == y2 and (c != 0) or (c > d and y - y1 < yd) or (c < d and y2 - y < yd):
		flag = 'NO'
	print(flag)
	t -= 1


n = int(input())
for i in range(n):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	ab = b - a
	cd = d - c
	k = True
	if x2 - x1 == 0:
		if a == 0 and b == 0:
			k = True
		else:
			k = False
	f = True
	if y2 - y1 == 0:
		if c == 0 and d == 0:
			f = True
		else:
			f = False
	if x1 <= x + ab <= x2 and y1 <= y + cd <= y2 and f and k:
		print('YES')
	else:
		print('NO')


t = int(input())
ans = []
for i in range(t):
	(a, b, c, d) = list(map(int, input().split()))
	(x, y, x1, y1, x2, y2) = list(map(int, input().split()))
	u = -a + b
	v = -c + d
	if a + b > 0 and x1 == x2:
		ans.append('No')
	elif c + d > 0 and y1 == y2:
		ans.append('No')
	elif x1 <= u + x <= x2 and y1 <= v + y <= y2:
		ans.append('Yes')
	else:
		ans.append('No')
for i in ans:
	print(i)


import math
alph = 'abcdefghijklmnopqrstuvwxyz'
t = int(input())
for i in range(t):
	(left, right, down, up) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	fy = True
	fx = True
	if down > up:
		if (y2 - y > 0 or y - y1 > 0) and y - y1 >= down - up:
			pass
		else:
			fy = False
	elif down == 0 and up == 0:
		pass
	elif (y2 - y > 0 or y - y1 > 0) and y2 - y >= up - down:
		pass
	else:
		fy = False
	if right > left:
		if (x - x1 > 0 or x2 - x > 0) and x2 - x >= right - left:
			pass
		else:
			fx = False
	elif right == 0 and left == 0:
		pass
	elif (x - x1 > 0 or x2 - x > 0) and x - x1 >= left - right:
		pass
	else:
		fx = False
	if fx * fy:
		print('Yes')
	else:
		print('No')


def func(a, b, c, d, x, y, x1, y1, x2, y2):
	x_bool = 0 < b - a <= x2 - x or (b - a < 0 and x - x1 >= a - b) or (b - a == 0 and b != 0 and (x2 > x or x > x1)) or (b == a == 0)
	y_bool = 0 < d - c <= y2 - y or (d - c < 0 and y - y1 >= c - d) or (d - c == 0 and d != 0 and (y2 > y or y > y1)) or (c == d == 0)
	return True if x_bool and y_bool else False
k = int(input())
for j in range(k):
	(aa, bb, cc, dd) = list(map(int, input().split()))
	(xx, yy, xx1, yy1, xx2, yy2) = list(map(int, input().split()))
	print('Yes' if func(aa, bb, cc, dd, xx, yy, xx1, yy1, xx2, yy2) else 'No')


def calc(a, b, c, d, x, y, x1, y1, x2, y2):
	hor_offset = b - a
	ver_offset = d - c
	hor_possible_offset = x + hor_offset
	ver_possible_offset = y + ver_offset
	if x2 - x1 < 1 and (a > 0 or b > 0):
		return False
	if y2 - y1 < 1 and (c > 0 or d > 0):
		return False
	if hor_possible_offset >= x1 and hor_possible_offset <= x2 and (ver_possible_offset >= y1) and (ver_possible_offset <= y2):
		return True
	return False
cases = int(input())
for _ in range(cases):
	(a, b, c, d) = list(map(int, input().split()))
	(x, y, x1, y1, x2, y2) = list(map(int, input().split()))
	ans = calc(a, b, c, d, x, y, x1, y1, x2, y2)
	if ans:
		print('Yes')
	else:
		print('No')


import bisect
import os
import io
from collections import Counter
from collections import defaultdict
import math
import random
import heapq as hq
from math import sqrt
import sys
from functools import reduce
from collections import deque
import threading

def input():
	return sys.stdin.readline().strip()

def iinput():
	return int(input())

def tinput():
	return input().split()

def rinput():
	return map(int, tinput())

def rlinput():
	return list(rinput())
mod = int(1000000000.0) + 7

def factors(n):
	return set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0)))
for _ in range(iinput()):
	(a, b, c, d) = rinput()
	(x, y, x1, y1, x2, y2) = rinput()
	temp = 1
	if a == 0 and b == 0:
		temp = 0
	temp1 = 1
	if c == 0 and d == 0:
		temp1 = 0
	if (x1 <= x - temp <= x2 or x1 <= x + temp <= x2) and (y1 <= y - temp1 <= y2 or y1 <= y + temp1 <= y2):
		horti = False
		if a < b:
			if x1 <= x + b - a <= x2:
				horti = True
		elif a > b:
			if x1 <= x - (a - b) <= x2:
				horti = True
		else:
			horti = True
		verti = False
		if c < d:
			if y1 <= y + d - c <= y2:
				verti = True
		elif c > d:
			if y1 <= y - (c - d) <= y2:
				verti = True
		else:
			verti = True
		if horti and verti:
			print('Yes')
		else:
			print('No')
	else:
		print('No')


t = int(input())
for _ in range(t):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	(flag1, flag2) = (0, 0)
	if x1 == x2:
		if not a and (not b):
			flag1 = 1
	else:
		flag1 = 1
	if y1 == y2:
		if not c and (not d):
			flag2 = 1
	else:
		flag2 = 1
	if not flag1 or not flag2:
		print('No')
		continue
	posx = x - (a - b)
	posy = y - (c - d)
	if x1 <= posx <= x2 and y1 <= posy <= y2:
		print('Yes')
	else:
		print('No')


from sys import exit

def i():
	return input()

def ii():
	return int(input())

def iis():
	return map(int, input().split())

def liis():
	return list(map(int, input().split()))

def print_array(a):
	print(' '.join(map(str, a)))
t = ii()
for _ in range(t):
	(l, r, d, u) = iis()
	(x, y, x1, y1, x2, y2) = iis()
	(y1, y2) = (min(y1, y2), max(y1, y2))
	(x1, x2) = (min(x1, x2), max(x1, x2))
	can = True
	if y - d + u > y2:
		can = False
	if y + u - d < y1:
		can = False
	if x - l + r > x2:
		can = False
	if x + r - l < x1:
		can = False
	if x1 == x2 and (l != 0 or r != 0):
		can = False
	if y1 == y2 and (u != 0 or d != 0):
		can = False
	if can:
		print('Yes')
	else:
		print('No')


def walk(a, b, c, d, x, y, x1, y1, x2, y2):
	fx = x + b - a
	fy = y + d - c
	if fx >= x1 and fx <= x2:
		if fy >= y1 and fy <= y2:
			if x == x1 and x == x2:
				if b != 0 or a != 0:
					return 'NO'
			if y == y1 and y == y2:
				if c != 0 or d != 0:
					return 'NO'
			return 'YES'
	return 'NO'
n = int(input())
for i in range(n):
	a = input()
	a = a.split()
	a1 = int(a[0])
	a2 = int(a[1])
	a3 = int(a[2])
	a4 = int(a[3])
	b = input()
	b = b.split()
	b1 = int(b[0])
	b2 = int(b[1])
	b3 = int(b[2])
	b4 = int(b[3])
	b5 = int(b[4])
	b6 = int(b[5])
	print(walk(a1, a2, a3, a4, b1, b2, b3, b4, b5, b6))


tc = int(input())
for ii in range(tc):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	onx = b - a
	ony = d - c
	newx = x + onx
	newy = y + ony
	boolz = 1
	if newx < x1 or newx > x2:
		boolz = 0
	if newy < y1 or newy > y2:
		boolz = 0
	if x1 == x2 and a + b > 0:
		boolz = 0
	if y1 == y2 and c + d > 0:
		boolz = 0
	if boolz:
		print('Yes')
	else:
		print('No')


t = int(input())
while t:
	(a, b, c, d) = [int(x) for x in input().split()]
	a_lim = abs(a - b)
	c_lim = abs(c - d)
	(x, y, x1, y1, x2, y2) = [int(x) for x in input().split()]
	x_max = max(abs(x - x1), abs(x - x2))
	y_max = max(abs(y - y1), abs(y - y2))
	if a > b and a - b > abs(x1 - x) or (a < b and b - a > abs(x - x2)) or (c > d and c - d > abs(y1 - y)) or (c < d and d - c > abs(y - y2)):
		print('No')
	elif x_max == 0 and (a > 0 or b > 0):
		print('No')
	elif y_max == 0 and (c > 0 or d > 0):
		print('No')
	else:
		print('Yes')
	t -= 1


for x in range(int(input())):
	(a, b, c, d) = [int(x) for x in input().split(' ')]
	(x, y, x1, y1, x2, y2) = [int(x) for x in input().split(' ')]
	cond1 = False
	cond2 = False
	if x1 <= x + b - a <= x2:
		if x1 < x2 or a + b == 0:
			cond1 = True
	if y1 <= y + d - c <= y2:
		if y1 < y2 or c + d == 0:
			cond2 = True
	if cond1 and cond2:
		print('Yes')
	else:
		print('No')


import sys
from collections import Counter

def input():
	return sys.stdin.readline().strip()

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]

def list4d(a, b, c, d, e):
	return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]

def ceil(x, y=1):
	return int(-(-x // y))

def INT():
	return int(input())

def MAP():
	return map(int, input().split())

def LIST(N=None):
	return list(MAP()) if N is None else [INT() for i in range(N)]

def Yes():
	print('Yes')

def No():
	print('No')

def YES():
	print('YES')

def NO():
	print('NO')
INF = 10 ** 18
MOD = 10 ** 9 + 7

def check(l, r, x, lcnt, rcnt):
	if lcnt == rcnt == 0:
		return True
	if lcnt == rcnt:
		return abs(l - x) >= 1 or abs(r - x) >= 1
	if lcnt > rcnt:
		cnt = lcnt - rcnt
		return abs(l - x) >= cnt
	if rcnt > lcnt:
		cnt = rcnt - lcnt
		return abs(r - x) >= cnt
for _ in range(INT()):
	(a, b, c, d) = MAP()
	(x, y, x1, y1, x2, y2) = MAP()
	if check(x1, x2, x, a, b) and check(y1, y2, y, c, d):
		Yes()
	else:
		No()


t = int(input())
for i in range(t):
	num1 = list(map(int, input().split()))
	num2 = list(map(int, input().split()))
	x = num2[0]
	y = num2[1]
	x1 = num2[2]
	y1 = num2[3]
	x2 = num2[4]
	y2 = num2[5]
	a = num1[0]
	b = num1[1]
	c = num1[2]
	d = num1[3]
	e = abs(a - b)
	f = abs(c - d)
	num3 = [abs(x - x1), abs(x - x2), abs(y - y1), abs(y - y2)]
	s = 0
	if e > num3[0] and a > b:
		s += 1
	if e > num3[1] and b > a:
		s += 1
	if f > num3[2] and c > d:
		s += 1
	if f > num3[3] and d > c:
		s += 1
	if x1 == x2 and a != 0 and (b != 0):
		s += 1
	if y1 == y2 and c != 0 and (d != 0):
		s += 1
	if s == 0 or (a == 0 and b == 0 and (c == 0) and (d == 0)):
		print('Yes')
	else:
		print('No')


n = int(input())
for i in range(n):
	(left, right, down, up) = list(map(int, input().split()))
	(x, y, x_left, y_down, x_right, y_up) = list(map(int, input().split()))
	lr_check = 0
	ud_check = 0
	if x - x_left == 0 and x_right - x == 0 and (right == left) and (right == 0):
		lr_check += 1
	if y - y_down == 0 and y_up - y == 0 and (up == down) and (up == 0):
		ud_check += 1
	if x - x_left > 0:
		if left - right <= x - x_left and left - right >= 0:
			lr_check += 1
	if x_right - x > 0:
		if right - left <= x_right - x and right - left >= 0:
			lr_check += 1
	if y - y_down > 0:
		if down - up <= y - y_down and down - up >= 0:
			ud_check += 1
	if y_up - y > 0:
		if up - down <= y_up - y and up - down >= 0:
			ud_check += 1
	if ud_check >= 1 and lr_check >= 1:
		print('Yes')
	else:
		print('No')


def solve(a, b, c, d, x, y, x0, y0, x1, y1):
	min_horiz = b - a
	if min_horiz == 0 and b != 0:
		if x == x0 and x == x1:
			return 'NO'
	elif min_horiz == 0 and b == 0:
		pass
	elif min_horiz > 0:
		if x + min_horiz > x1:
			return 'NO'
	elif x + min_horiz < x0:
		return 'NO'
	min_vert = d - c
	if min_vert == 0 and d != 0:
		if y == y0 and y == y1:
			return 'NO'
	elif min_vert == 0 and d == 0:
		pass
	elif min_vert > 0:
		if y + min_vert > y1:
			return 'NO'
	elif y + min_vert < y0:
		return 'NO'
	return 'YES'

def main():
	nr = int(input())
	for _ in range(nr):
		(a, b, c, d) = [int(s) for s in input().split(' ')]
		(x, y, x0, y0, x1, y1) = [int(s) for s in input().split(' ')]
		print(solve(a, b, c, d, x, y, x0, y0, x1, y1))
main()


for gh in range(int(input())):
	(a, b, c, d) = list(map(int, input().split()))
	(x, y, x1, y1, x2, y2) = list(map(int, input().split()))
	xi = x - a + b
	yi = y - c + d
	if x1 == x2 and y1 == y2 and (a != 0 or b != 0 or c != 0 or (d != 0)):
		print('No')
	elif x1 == x2 and y1 != y2 and (a != 0 or b != 0):
		print('No')
	elif x1 != x2 and y1 == y2 and (c != 0 or d != 0):
		print('No')
	elif x1 <= xi <= x2 and y1 <= yi <= y2:
		print('Yes')
	else:
		print('No')


from sys import stdin, stdout
import math
t = int(stdin.readline())
for test in range(t):
	arr1 = [int(x) for x in stdin.readline().split()]
	arr2 = [int(x) for x in stdin.readline().split()]
	a = arr1[0]
	b = arr1[1]
	c = arr1[2]
	d = arr1[3]
	x = arr2[0]
	y = arr2[1]
	x1 = arr2[2]
	y1 = arr2[3]
	x2 = arr2[4]
	y2 = arr2[5]
	perm_horz = x2 - x1 + x
	perm_vert = y2 - y1 + y
	horz = x - a + b
	vert = y - c + d
	if x + min(1, b) > x2 and x - min(1, a) < x1 or (y + min(1, d) > y2 and y - min(1, c) < y1):
		stdout.write('No\n')
	elif (horz <= x2 and horz >= x1) and (vert <= y2 and vert >= y1):
		stdout.write('Yes\n')
	else:
		stdout.write('No\n')


t = int(input())
while t > 0:
	t -= 1
	(a, b, c, d) = [int(x) for x in input().split()]
	(x, y, x1, y1, x2, y2) = [int(x) for x in input().split()]
	h = 0
	v = 0
	r = b - a
	if r >= 0 and r <= x2 - x or (r <= 0 and r >= x1 - x):
		h = 1
	r = d - c
	if r >= 0 and r <= y2 - y or (r <= 0 and r >= y1 - y):
		v = 1
	if x1 == x2:
		if a or b:
			h = 0
	if y1 == y2:
		if c or d:
			v = 0
	if h == 1 and v == 1:
		print('Yes')
	else:
		print('No')


import math
for w in range(int(input())):
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	x = abs(a[0] - a[1])
	flagx = 0
	flagy = 0
	if a[0] != 0 and a[1] != 0:
		flagx = 1
	if a[2] != 0 and a[3] != 0:
		flagy = 1
	if a[0] >= a[1]:
		b[0] -= x
	else:
		b[0] += x
	y = abs(a[2] - a[3])
	if a[2] >= a[3]:
		b[1] -= y
	else:
		b[1] += y
	if b[2] <= b[0] and b[0] <= b[4] and (b[3] <= b[1]) and (b[1] <= b[5]):
		if b[2] <= b[0] - flagx and b[0] <= b[4] or (b[2] <= b[0] and b[0] + flagx <= b[4]):
			if b[3] <= b[1] - flagy and b[1] <= b[5] or (b[3] <= b[1] and b[1] + flagy <= b[5]):
				print('YES')
			else:
				print('NO')
		else:
			print('NO')
	else:
		print('NO')


for T in range(int(input())):
	steps = [int(x) for x in input().split()]
	coordi = [int(x) for x in input().split()]
	coordi[2] -= coordi[0]
	coordi[4] -= coordi[0]
	coordi[3] -= coordi[1]
	coordi[5] -= coordi[1]
	coordi[0] = 0
	coordi[1] = 0
	if steps[1] - steps[0] >= coordi[2] and steps[1] - steps[0] <= coordi[4]:
		if steps[3] - steps[2] >= coordi[3] and steps[3] - steps[2] <= coordi[5]:
			if coordi[2] == coordi[4]:
				if steps[0] != 0 or steps[1] != 0:
					print('no')
				elif coordi[0] != coordi[2]:
					print('no')
				elif coordi[3] == coordi[5]:
					if steps[2] != 0 or steps[3] != 0:
						print('no')
					elif coordi[3] != coordi[1]:
						print('no')
					else:
						print('yes')
				else:
					print('yes')
			elif coordi[3] == coordi[5]:
				if steps[2] != 0 or steps[3] != 0:
					print('no')
				elif coordi[3] != coordi[1]:
					print('no')
				else:
					print('yes')
			else:
				print('yes')
		else:
			print('no')
	else:
		print('no')


import sys, math, cmath
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return s[:len(s) - 1]

def invr():
	return map(int, input().split())
t = 1
t = inp()
for tt in range(t):
	(a, b, c, d) = invr()
	(x, y, x1, y1, x2, y2) = invr()
	q = x + b - a
	w = y + d - c
	if q < x1 or q > x2 or w > y2 or (w < y1) or (a > b and x1 >= x) or (b > a and x >= x2) or (c > d and y1 >= y) or (d > c and y >= y2) or (a == b and a > 0 and (x <= x1) and (x >= x2)) or (c == d and c > 0 and (y <= y1) and (y >= y2)):
		print('No')
	else:
		print('Yes')


t = int(input())
for _ in range(t):
	(l, r, d, up) = map(int, input().split())
	(u, v, x1, y1, x2, y2) = map(int, input().split())
	if x1 == x2 and (l > 0 or r > 0):
		print('NO')
		continue
	if y1 == y2 and (d > 0 or up > 0):
		print('NO')
		continue
	if l > r:
		l = l - r
		r = 0
	else:
		r = r - l
		l = 0
	if d > up:
		d = d - up
		up = 0
	else:
		up = up - d
		d = 0
	if l > r:
		if u - l >= x1:
			u = u - l
		else:
			print('NO')
			continue
	elif u + r <= x2:
		u = u + r
	else:
		print('NO')
		continue
	if up > d:
		if v + up <= y2:
			v = v + up
		else:
			print('NO')
			continue
	elif v - d >= y1:
		v = v - d
	else:
		print('NO')
		continue
	print('YES')
	t -= 1


t = int(input())
for _ in range(0, t):
	(l, r, d, u) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	le = abs(x - x1)
	ri = abs(x2 - x)
	do = abs(y - y1)
	up = abs(y2 - y)
	if le == 0 and ri == 0 and (l != 0 or r != 0):
		print('No')
	elif do == 0 and up == 0 and (d != 0 or u != 0):
		print('No')
	else:
		flag = 0
		temp1 = abs(l - r)
		temp2 = abs(u - d)
		if temp1 != 0:
			if l > r:
				if temp1 > le:
					flag = 1
			elif temp1 > ri:
				flag = 1
		if temp2 != 0:
			if u > d:
				if temp2 > up:
					flag = 1
			elif temp2 > do:
				flag = 1
		if flag == 1:
			print('No')
		else:
			print('Yes')


t = int(input())
for i in range(t):
	abcd = [int(x) for x in input().split()]
	lr = abcd[0] - abcd[1]
	du = abcd[2] - abcd[3]
	xy = [int(x) for x in input().split()]
	yes = True
	if xy[0] - xy[2] == 0 and xy[4] - xy[0] == 0 and (abcd[0] > 0 or abcd[1] > 0):
		yes = False
	if xy[1] - xy[3] == 0 and xy[5] - xy[1] == 0 and (abcd[2] > 0 or abcd[3] > 0):
		yes = False
	if lr > 0 and abs(xy[0] - xy[2]) < lr:
		yes = False
	if lr < 0 and abs(xy[4] - xy[0]) < lr * -1:
		yes = False
	if du > 0 and abs(xy[1] - xy[3]) < du:
		yes = False
	if du < 0 and abs(xy[5] - xy[1]) < du * -1:
		yes = False
	if yes:
		print('YES')
	else:
		print('NO')


import sys
input = sys.stdin.readline
from math import *
mod = 10 ** 9 + 7

def bo(i):
	return ord(i) - ord('a')
t = int(input())
while t > 0:
	t -= 1
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	if x1 <= -a + b + x <= x2 and y1 <= -c + d + y <= y2 and (not (x1 == x2 and (a > 0 or b > 0))) and (not (y1 == y2 and (c > 0 or d > 0))):
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(l, r, d, u) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	ans = True
	x1_dis = x - x1
	x2_dis = x2 - x
	y1_dis = y - y1
	y2_dis = y2 - y
	if x < x1 or x > x2 or y < y1 or (y > y2):
		ans = False
	if l - r > x1_dis:
		ans = False
	if r - l > x2_dis:
		ans = False
	if d - u > y1_dis:
		ans = False
	if u - d > y2_dis:
		ans = False
	if x1 - x2 == 0 and (l != 0 or r != 0) or (y1 - y2 == 0 and (d != 0 or u != 0)):
		ans = False
	if ans:
		print('YES')
	else:
		print('NO')


t = int(input())
for j in range(t):
	(a, b, c, d) = [int(i) for i in input().split()]
	(x, y, x1, y1, x2, y2) = [int(i) for i in input().split()]
	p = False
	q = False
	if x1 <= x - a + b and x2 >= x - a + b and (x1 != x2 or a + b == 0):
		p = True
	if y1 <= y - c + d and y2 >= y - c + d and (y1 != y2 or c + d == 0):
		q = True
	if p and q:
		print('Yes')
	else:
		print('No')


from sys import stdin, stdout
import math
from collections import defaultdict
t = int(stdin.readline())
for _ in range(t):
	(a, b, c, d) = (int(x) for x in stdin.readline().split())
	(x, y, x1, y1, x2, y2) = (int(x) for x in stdin.readline().split())
	if a + b > 0 and x1 == x2:
		print('No')
		continue
	if c + d > 0 and y1 == y2:
		print('No')
		continue
	if x1 <= x + b - a <= x2 and y1 <= y + d - c <= y2:
		print('Yes')
	else:
		print('No')


for _ in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	(left, right, down, up) = (a - b, b - a, c - d, d - c)
	(leftbound, rightbound, downbound, upbound) = (x - x1, x2 - x, y - y1, y2 - y)
	if leftbound == rightbound == 0 and (a != 0 or b != 0):
		print('No')
		continue
	if downbound == upbound == 0 and (c != 0 or d != 0):
		print('No')
		continue
	if left <= leftbound and right <= rightbound and (down <= downbound) and (up <= upbound):
		print('Yes')
	else:
		print('No')


def check_path():
	(a, b, c, d) = [int(_) for _ in input().split()]
	(x, y, x1, y1, x2, y2) = [int(_) for _ in input().split()]
	x_len = x2 - x1
	y_len = y2 - y1
	if x_len == 0 and (a != 0 or b != 0):
		return 'No'
	if y_len == 0 and (c != 0 or d != 0):
		return 'No'
	x_max_div = min(a // x_len, b // x_len) if x_len else 0
	y_max_div = min(c // y_len, d // y_len) if y_len else 0
	a -= x_max_div * x_len
	b -= x_max_div * x_len
	c -= y_max_div * y_len
	d -= y_max_div * y_len
	x_left = x - x1
	x_right = x2 - x
	y_down = y - y1
	y_up = y2 - y
	if a > b and a - b > x_left:
		return 'No'
	elif b > a and b - a > x_right:
		return 'No'
	if c > d and c - d > y_down:
		return 'No'
	elif d > c and d - c > y_up:
		return 'No'
	return 'Yes'
n = int(input())
for i in range(n):
	print(check_path())


import sys
from copy import deepcopy
for t in range(int(sys.stdin.readline().strip())):
	(a, b, c, d) = [int(j) for j in sys.stdin.readline().split()]
	(x, y, x1, y1, x2, y2) = [int(j) for j in sys.stdin.readline().split()]
	if abs(x - x1) >= 1 or abs(x - x2) >= 1:
		rt = b - a
	else:
		rt = max(a, b)
	if abs(y - y1) >= 1 or abs(y - y2) >= 1:
		down = c - d
	else:
		down = max(c, d)
	if x + rt <= x2 and x + rt >= x1:
		if y - down <= y2 and y - down >= y1:
			print('Yes')
		else:
			print('No')
	else:
		print('No')


for _ in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	q = x - (a - b)
	w = y - (c - d)
	q1 = q
	w1 = w
	if q == x and a != 0:
		q = x - 1
		q1 = x + 1
	if w == y and c != 0:
		w = y - 1
		w1 = y + 1
	if q >= x1 and q <= x2 and (w >= y1) and (w <= y2) or (q1 >= x1 and q1 <= x2 and (w1 >= y1) and (w1 <= y2)) or (q1 >= x1 and q1 <= x2 and (w >= y1) and (w <= y2)) or (q >= x1 and q <= x2 and (w1 >= y1) and (w1 <= y2)):
		print('YES')
	else:
		print('NO')


T = int(input())
for case in range(1, T + 1):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	x_ok = x1 <= x - a + b <= x2 and (x1 < x2 or a + b == 0)
	y_ok = y1 <= y - c + d <= y2 and (y1 < y2 or c + d == 0)
	print('Yes' if x_ok and y_ok else 'No')


printn = lambda x: print(x, end='')
inn = lambda : int(input())
inl = lambda : list(map(int, input().split()))
inm = lambda : map(int, input().split())
ins = lambda : input().strip()
DBG = True
BIG = 10 ** 18
R = 10 ** 9 + 7

def ddprint(x):
	if DBG:
		print(x)
t = inn()
for tt in range(t):
	(a, b, c, d) = inm()
	(x, y, x1, y1, x2, y2) = inm()
	cnd = x1 <= x + b - a <= x2 and (not (x1 == x2 == x and a + b >= 1)) and (y1 <= y + d - c <= y2) and (not (y1 == y2 == y and c + d >= 1))
	print('Yes' if cnd else 'No')


def solve(a, b, c, d, x, y, x1, y1, x2, y2):
	if not (x1 <= x <= x2 and y1 <= y <= y2):
		return False
	if b > 0 and x + 1 <= x2:
		if a > b:
			a -= b
			b = 0
		else:
			b -= a
			a = 0
	if a > 0 and x - 1 >= x1:
		if a > b:
			a -= b
			b = 0
		else:
			b -= a
			a = 0
	if d > 0 and y + 1 <= y2:
		if c > d:
			c -= d
			d = 0
		else:
			d -= c
			c = 0
	if c > 0 and y - 1 >= y1:
		if c > d:
			c -= d
			d = 0
		else:
			d -= c
			c = 0
	if x1 <= x - a <= x2 and x1 <= x + b <= x2 and (y1 <= y - c <= y2) and (y1 <= y + d <= y2):
		return True
	return False
for _ in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	if solve(a, b, c, d, x, y, x1, y1, x2, y2):
		print('YES')
	else:
		print('NO')


t = int(input())
while t > 0:
	t -= 1
	(a, b, c, d) = [int(i) for i in input().split()]
	(x, y, x1, y1, x2, y2) = [int(i) for i in input().split()]
	hori = x - a + b
	verti = y - c + d
	if hori >= x1 and hori <= x2 and (verti >= y1) and (verti <= y2) and (x2 - x1 != 0 or a + b == 0) and (y2 - y1 != 0 or c + d == 0):
		print('Yes')
	else:
		print('No')


t = int(input())
for _ in range(t):
	(a, b, c, d) = list(map(int, input().rstrip().split()))
	(x, y, x1, y1, x2, y2) = list(map(int, input().rstrip().split()))
	chk = True
	xf = x + b - a
	yf = y + d - c
	if x2 == x1 and (a > 0 or b > 0) or (y2 == y1 and (c > 0 or d > 0)):
		print('NO')
		continue
	if (xf > x2 or xf < x1) or (yf > y2 or yf < y1):
		print('NO')
		continue
	else:
		print('YES')


cases = int(input())
for i in range(cases):
	(a, b, c, d) = list(map(int, input().split(' ')))
	(x, y, x1, y1, x2, y2) = list(map(int, input().split(' ')))
	movesRight = b - a
	movesDown = d - c
	if x2 - x1 == 0 and (a != 0 or b != 0):
		print('NO')
	elif y2 - y1 == 0 and (d != 0 or c != 0):
		print('NO')
	elif x + movesRight <= x2 and x + movesRight >= x1 and (y + movesDown <= y2) and (y + movesDown >= y1):
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	w = abs(x2 - x1)
	h = abs(y2 - y1)
	xf = b - a + x
	yf = d - c + y
	if a + b > 0 and x1 == x2:
		answer = 'NO'
	elif c + d > 0 and y2 == y1:
		answer = 'NO'
	elif x1 <= xf <= x2 and y1 <= yf <= y2:
		answer = 'YES'
	else:
		answer = 'NO'
	print(answer)


t = int(input())
for _ in range(t):
	(left, right, down, up) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	dx = right - left
	dy = up - down

	def possible():
		if x1 == x2:
			if right or left:
				return False
		if y1 == y2:
			if up or down:
				return False
		if x1 <= x + dx <= x2 and y1 <= y + dy <= y2:
			return True
		else:
			return False
	if possible():
		print('Yes')
	else:
		print('No')


t = int(input())
ans = False
for case in range(t):
	entrada = [int(x) for x in input().split()]
	(a, b, c, d) = entrada
	entrada = [int(x) for x in input().split()]
	(x, y, x1, y1, x2, y2) = entrada
	left = x - x1
	right = x2 - x
	top = y2 - y
	bottom = y - y1
	if x1 == x2 and (a > 0 or b > 0):
		print('NO')
	elif y1 == y2 and (c > 0 or d > 0):
		print('NO')
	else:
		if b >= a:
			ans = b - a <= right
		else:
			ans = a - b <= left
		if ans:
			if d >= c:
				ans = d - c <= top
			else:
				ans = c - d <= bottom
		if ans:
			print('YES')
		else:
			print('NO')


def read_nums():
	return [int(x) for x in input().split()]

def main():
	(t,) = read_nums()
	for _ in range(t):
		(l, r, d, u) = read_nums()
		(x, y, x1, y1, x2, y2) = read_nums()
		if x1 == x2 and (r > 0 or l > 0):
			print('NO')
		elif y1 == y2 and (u > 0 or d > 0):
			print('NO')
		elif r - l > x2 - x or l - r > x - x1:
			print('NO')
		elif u - d > y2 - y or d - u > y - y1:
			print('NO')
		else:
			print('YES')
main()


def testcase():
	(a, b, c, d) = [int(i) for i in input().split()]
	(x, y, x1, y1, x2, y2) = [int(i) for i in input().split()]
	left = a - b
	down = c - d
	if x1 <= x - left and x - left <= x2 and (y1 <= y - down) and (y - down <= y2):
		if left == 0 and a != 0 and (x1 == x2):
			print('No')
		elif down == 0 and c != 0 and (y2 == y1):
			print('No')
		else:
			print('Yes')
	else:
		print('No')
t = int(input())
for test in range(t):
	testcase()


t = int(input())
for i in range(t):
	abcd = [int(j) for j in input().split()]
	(a, b, c, d) = (abcd[0], abcd[1], abcd[2], abcd[3])
	line = [int(j) for j in input().split()]
	(x, y, x1, y1, x2, y2) = (line[0], line[1], line[2], line[3], line[4], line[5])
	horizontal = b - a
	vertical = d - c
	(nx, ny) = (horizontal + x, vertical + y)
	if x2 - x1 == 0 and (a > 0 or b > 0):
		print('No')
		continue
	if y2 - y1 == 0 and (c > 0 or d > 0):
		print('No')
		continue
	if nx <= x2 and nx >= x1 and (ny <= y2) and (ny >= y1):
		print('Yes')
	else:
		print('No')


def check(y, y1, y2, c, d):
	if c == 0 and d <= y2 - y:
		return True
	elif d == 0 and c <= y - y1:
		return True
	elif c >= d and y2 - y + y - y1 > 0 and (c - d <= y - y1):
		return True
	elif d >= c and y2 - y + y - y1 > 0 and (d - c <= y2 - y):
		return True
	return False
t = int(input())
s = ''
while t > 0:
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	if a == 0 and b <= x2 - x and check(y, y1, y2, c, d):
		s += 'Yes\n'
	elif b == 0 and a <= x - x1 and check(y, y1, y2, c, d):
		s += 'Yes\n'
	elif a >= b and x2 - x + x - x1 > 0 and (a - b <= x - x1) and check(y, y1, y2, c, d):
		s += 'Yes\n'
	elif b >= a and x2 - x + x - x1 > 0 and (b - a <= x2 - x) and check(y, y1, y2, c, d):
		s += 'Yes\n'
	else:
		s += 'No\n'
	t -= 1
print(s)


import sys
try:
	sys.stdin = open(sys.path[0] + '\\input.txt', 'r')
	sys.stdout = open(sys.path[0] + '\\output.txt', 'w')
except FileNotFoundError:
	pass
for tc in range(int(input())):
	(a, b, c, d) = list(map(int, input().split()))
	(x, y, x1, y1, x2, y2) = list(map(int, input().split()))
	if x1 == x2 and (a > 0 or b > 0) or (y1 == y2 and (c > 0 or d > 0)):
		print('No')
		continue
	xx = x + b - a
	yy = y + d - c
	if x1 <= xx <= x2 and y1 <= yy <= y2:
		print('Yes')
	else:
		print('No')


t = int(input())
for _ in range(t):
	(d, c, a, b) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	left = y - y1
	right = y2 - y
	up = x - x1
	down = x2 - x
	check = 1
	if a > b:
		rem = a - b
		if left < rem:
			check = 0
	elif b > a:
		rem = b - a
		if right < rem:
			check = 0
	elif a and b and (y2 - y1 + 1 < 2):
		check = 0
	if c > d:
		rem = c - d
		if down < rem:
			check = 0
	elif d > c:
		rem = d - c
		if up < rem:
			check = 0
	elif c and d and (x2 - x1 + 1 < 2):
		check = 0
	if check:
		print('Yes')
	else:
		print('No')


tests = int(input())
abcds = []
arrays = []
for i in range(0, tests):
	abcds.append(list(map(int, input().split())))
	arrays.append(list(map(int, input().split())))
for i in range(0, tests):
	abcd = abcds[i]
	array = arrays[i]
	l = abcd[0]
	r = abcd[1]
	u = abcd[3]
	d = abcd[2]
	x = array[0]
	y = array[1]
	x1 = array[2]
	y1 = array[3]
	x2 = array[4]
	y2 = array[5]
	xflag = 0
	yflag = 0
	flag = 0
	if x2 == x and x1 == x:
		if r != 0 or l != 0:
			print('NO')
			flag = 1
	if y2 == y and y1 == y and (flag == 0):
		if u != 0 or d != 0:
			print('NO')
			flag = 1
	if r - l >= 0:
		if x2 - x >= r - l:
			xflag = 1
	if r - l < 0:
		if x - x1 >= l - r:
			xflag = 1
	if u - d >= 0:
		if y2 - y >= u - d:
			yflag = 1
	if u - d < 0:
		if y - y1 >= d - u:
			yflag = 1
	if xflag == 1 and yflag == 1 and (flag == 0):
		print('YES')
	elif flag == 0:
		print('NO')


t = int(input())
for i in range(t):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	l = x - x1
	r = x2 - x
	u = y2 - y
	do = y - y1
	if x1 == x2 and (a > 0 or b > 0):
		print('NO')
		continue
	if y1 == y2 and (c > 0 or d > 0):
		print('NO')
		continue
	if a >= b:
		if a - b > l:
			print('NO')
			continue
	elif b - a > r:
		print('NO')
		continue
	if c >= d:
		if c - d > do:
			print('NO')
			continue
	elif d - c > u:
		print('NO')
		continue
	print('YES')


t = int(input())
for _ in range(t):
	(a, b, c, d) = list(map(int, input().split()))
	(x, y, x1, y1, x2, y2) = list(map(int, input().split()))
	possible = True
	if a != 0 and a == b and (not x1 <= x - 1 <= x2) and (not x1 <= x + 1 <= x2):
		possible = False
	if c != 0 and c == d and (not y1 <= y - 1 <= y2) and (not y1 <= y + 1 <= y2):
		possible = False
	if not (x1 <= x - a + b <= x2 and y1 <= y + d - c <= y2):
		possible = False
	if possible:
		print('YES')
	else:
		print('NO')


def canwalk(a, b, c, d, x, y, x1, y1, x2, y2):
	if x1 == x2 and (a > 0 or b > 0):
		return 'NO'
	if y1 == y2 and (c > 0 or d > 0):
		return 'NO'
	if b + abs(x - x1) >= a and a + abs(x - x2) >= b:
		if d + abs(y - y1) >= c and c + abs(y - y2) >= d:
			return 'YES'
	return 'NO'
cases = int(input())
for _ in range(cases):
	(a, b, c, d) = list(map(int, input().split()))
	(x, y, x1, y1, x2, y2) = list(map(int, input().split()))
	print(canwalk(a, b, c, d, x, y, x1, y1, x2, y2))


t = int(input())
for _ in range(t):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	if a > b:
		a = a - b
		b = 0
	elif b > a:
		b = b - a
		a = 0
	elif a == 0 and b == 0:
		a = 0
		b = 0
	elif x == x1:
		a = 0
		b = 1
	else:
		a = 1
		b = 0
	x_range = [x - a, x + b]
	if c > d:
		c = c - d
		d = 0
	elif d > c:
		d = d - c
		c = 0
	elif c == 0 and d == 0:
		c = 0
		d = 0
	elif y == y1:
		c = 0
		d = 1
	else:
		c = 1
		d = 0
	y_range = [y - c, y + d]
	hor = (x_range[0] >= x1 and x_range[0] <= x2) and (x_range[1] >= x1 and x_range[1] <= x2)
	ver = (y_range[0] >= y1 and y_range[0] <= y2) and (y_range[1] >= y1 and y_range[1] <= y2)
	if hor and ver:
		print('YES')
	else:
		print('NO')


import sys
testcases = int(sys.stdin.readline())
for i in range(testcases):
	abcd = sys.stdin.readline().split()
	a = int(abcd[0])
	b = int(abcd[1])
	c = int(abcd[2])
	d = int(abcd[3])
	xyx1y1x2y2 = sys.stdin.readline().split()
	x = int(xyx1y1x2y2[0])
	y = int(xyx1y1x2y2[1])
	x1 = int(xyx1y1x2y2[2])
	y1 = int(xyx1y1x2y2[3])
	x2 = int(xyx1y1x2y2[4])
	y2 = int(xyx1y1x2y2[5])
	if (x1 <= x <= x2 and y1 <= y <= y2) and (x1 <= x - a + b <= x2 and y1 <= y - c + d <= y2):
		if x2 == x1 and max(a, b) > 0:
			print('NO')
		elif y2 == y1 and max(c, d) > 0:
			print('NO')
		else:
			print('YES')
	else:
		print('NO')


t = int(input())
i = 0
while i < t:
	(l, r, d, u) = map(int, input().split())
	(x, y, xl, yd, xr, yu) = map(int, input().split())
	result = 1
	if xl == xr and l + r > 0:
		result = 0
	if yd == yu and d + u > 0:
		result = 0
	if r - l > xr - x or l - r > x - xl:
		result = 0
	if u - d > yu - y or d - u > y - yd:
		result = 0
	if result == 1:
		print('YES')
	else:
		print('NO')
	i = i + 1


def valid_path(steps, locations):
	(a, b, c, d) = steps
	(x, y, x1, y1, x2, y2) = locations
	if x1 == x and x2 == x and (a or b):
		print('NO')
		return
	if y1 == y and y2 == y and (c or d):
		print('NO')
		return
	if x - (a - b) < x1:
		print('NO')
		return
	if x - (a - b) > x2:
		print('NO')
		return
	if y - (c - d) < y1:
		print('NO')
		return
	if y - (c - d) > y2:
		print('NO')
		return
	print('YES')
t = int(input())
for _ in range(t):
	steps = list(map(int, input().split()))
	locations = list(map(int, input().split()))
	valid_path(steps, locations)


def solve() -> bool:
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	if x == x1 == x2 and a + b > 0 or (y == y1 == y2 and c + d > 0):
		return False
	return x1 <= x + b - a <= x2 and y1 <= y + d - c <= y2

def main():
	t = int(input())
	while t > 0:
		print('Yes' if solve() else 'No')
		t -= 1
main()


def findwalk(x, y, x1, y1, x2, y2, left, right, down, up):
	if x1 == x2 and (left != 0 or right != 0) or (y1 == y2 and (up != 0 or down != 0)):
		print('No')
		return False
	if left - right > x - x1:
		print('No')
		return False
	if right - left > x2 - x:
		print('No')
		return False
	if up - down > y2 - y:
		print('No')
		return False
	if down - up > y - y1:
		print('No')
		return False
	print('Yes')
	return True
while True:
	try:
		s = input()
		while len(s.split()) == 1:
			s = input()
		t = input()
		mewList = t.split() + s.split()
		List = []
		for i in mewList:
			List.append(int(i))
		findwalk(List[0], List[1], List[2], List[3], List[4], List[5], List[6], List[7], List[8], List[9])
	except EOFError:
		break


def check_possible(moves, board):
	(a, b, c, d) = tuple(moves)
	(x, y, x1, y1, x2, y2) = tuple(board)
	(netx, nety) = (b - a, d - c)
	if x + netx < x1 or x + netx > x2 or y + nety < y1 or (y + nety > y2):
		print('NO')
	elif a + b > 0 and x2 - x1 == 0:
		print('NO')
	elif c + d > 0 and y2 - y1 == 0:
		print('NO')
	else:
		print('YES')
for _ in range(int(input())):
	moves = map(int, input().split())
	board = map(int, input().split())
	check_possible(moves, board)


def I():
	return map(int, input().strip().split())
for h in range(int(input())):
	(L, R, D, U) = I()
	(x, y, x1, y1, x2, y2) = I()
	if x1 == x2 == x and L + R != 0:
		print('NO')
		continue
	if y1 == y2 == y and U + D != 0:
		print('NO')
		continue
	if x1 <= x + R - L <= x2 and y1 <= y + U - D <= y2:
		print('YES')
	else:
		print('NO')


n = int(input())
for _ in range(n):
	(a, b, c, d) = map(int, input().split())
	(m, n, o, p, q, r) = map(int, input().split())
	if a > b:
		if c > d:
			if o <= m - abs(b - a) and p <= n - abs(d - c):
				print('YES')
			else:
				print('No')
		elif c == d:
			if c >= 1:
				if o <= m - abs(b - a) and (p <= n - 1 or r >= n + 1):
					print('YES')
				else:
					print('No')
			elif c == 0:
				if o <= m - abs(b - a) and (p <= n - c or r >= n + d):
					print('YES')
				else:
					print('No')
		elif o <= m - abs(b - a) and r >= n + abs(d - c):
			print('YES')
		else:
			print('No')
	elif a == b:
		if a >= 1:
			if c > d:
				if (o <= m - 1 or q >= m + 1) and p <= n - abs(d - c):
					print('YES')
				else:
					print('No')
			elif c == d:
				if c >= 1:
					if (o <= m - 1 or q >= m + 1) and (p <= n - 1 or r >= n + 1):
						print('YES')
					else:
						print('No')
				elif c == 0:
					if (o <= m - 1 or q >= m + 1) and (p <= n or r >= n):
						print('YES')
					else:
						print('No')
			elif (o <= m - 1 or q >= m + 1) and r >= n + abs(d - c):
				print('YES')
			else:
				print('No')
		elif a == 0:
			if c > d:
				if (o <= m - a or q >= m + b) and p <= n - abs(d - c):
					print('YES')
				else:
					print('No')
			elif c == d:
				if c >= 1:
					if (o <= m - a or q >= m + b) and (p <= n - 1 or r >= n + 1):
						print('YES')
					else:
						print('No')
				elif c == 0:
					if (o <= m or q >= m) and (p <= n or r >= n):
						print('YES')
					else:
						print('No')
			elif (o <= m - a or q >= m + b) and r >= n + abs(d - c):
				print('YES')
			else:
				print('No')
	elif c > d:
		if q >= m + abs(b - a) and p <= n - abs(d - c):
			print('YES')
		else:
			print('No')
	elif c == d:
		if c >= 1:
			if q >= m + abs(b - a) and (p <= n - 1 or r >= n + 1):
				print('YES')
			else:
				print('No')
		elif c == 0:
			if q >= m + abs(b - a) and (p <= n - c or r >= n + d):
				print('YES')
			else:
				print('No')
	elif q >= m + abs(b - a) and r >= n + abs(d - c):
		print('YES')
	else:
		print('No')


from sys import stdin
input = stdin.readline

def A():
	t = int(input())
	for _ in range(t):
		(a, b, c, d) = map(int, input().split())
		(x, y, x1, y1, x2, y2) = map(int, input().split())
		netr = b - a
		netu = d - c
		if x1 == x2 and (a > 0 or b > 0):
			print('No')
			continue
		if y1 == y2 and (c > 0 or d > 0):
			print('No')
			continue
		if netr + x < x1 or netr + x > x2:
			print('No')
			continue
		if netu + y < y1 or netu + y > y2:
			print('No')
			continue
		print('Yes')
A()


import sys
reader = (s.rstrip() for s in sys.stdin)
input = reader.__next__

def gift():
	for _ in range(t):
		(a, b, c, d) = list(map(int, input().split()))
		(x, y, x1, y1, x2, y2) = list(map(int, input().split()))
		endx = x + (b - a)
		endy = y + (d - c)
		if x1 == x2 and (a != 0 or b != 0):
			yield 'NO'
		elif y1 == y2 and (c != 0 or d != 0):
			yield 'NO'
		elif x1 <= endx <= x2 and y1 <= endy <= y2:
			yield 'YES'
		else:
			yield 'NO'
t = int(input())
ans = gift()
print(*ans, sep='\n')


for _ in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	if x == x1 and x == x2 and (a != 0 or b != 0):
		print('no')
		continue
	if y == y1 and y == y2 and (c != 0 or d != 0):
		print('no')
		continue
	if a > b:
		if x - x1 < a - b:
			print('no')
			continue
	elif a < b:
		if x2 - x < b - a:
			print('no')
			continue
	if c > d:
		if y - y1 < c - d:
			print('no')
			continue
	elif c < d:
		if y2 - y < d - c:
			print('no')
			continue
	print('yes')


t = int(input())
while t:
	t -= 1
	moves = list((int(x) for x in input().split()))
	xy = list((int(x) for x in input().split()))
	(x, y, x1, y1, x2, y2) = (xy[0], xy[1], xy[2], xy[3], xy[4], xy[5])
	move_v = moves[1] - moves[0]
	move_h = moves[3] - moves[2]
	if not move_v and moves[0] and (x2 - x1 == 0):
		print('No')
	elif not move_h and moves[2] and (y2 - y1 == 0):
		print('No')
	elif x1 <= x + move_v <= x2 and y1 <= y + move_h <= y2:
		print('Yes')
	else:
		print('No')


for _ in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	flag = 0
	if a > b:
		if abs(x - x1) < a - b:
			flag = 1
	elif a < b:
		if abs(x - x2) < b - a:
			flag = 1
	elif abs(x - x2) == 0 and abs(x - x1) == 0 and (a > 0):
		flag = 1
	if c > d:
		if abs(y - y1) < c - d:
			flag = 1
	elif d > c:
		if abs(y - y2) < d - c:
			flag = 1
	elif abs(y - y1) == 0 and abs(y - y2) == 0 and (c > 0):
		flag = 1
	if flag == 1:
		print('No')
	else:
		print('Yes')


def solve(a, b, c, d, x, y, x1, y1, x2, y2):
	if isValid1(x + 1, x1, x2) or isValid1(x - 1, x1, x2):
		temp = min(a, b)
		a -= temp
		b -= temp
	if isValid1(y + 1, y1, y2) or isValid1(y - 1, y1, y2):
		temp = min(c, d)
		c -= temp
		d -= temp
	if a > 0 and isValid1(x - a, x1, x2) == False:
		print('NO')
		return
	if b > 0 and isValid1(x + b, x1, x2) == False:
		print('NO')
		return
	if c > 0 and isValid1(y - c, y1, y2) == False:
		print('NO')
		return
	if d > 0 and isValid1(y + d, y1, y2) == False:
		print('NO')
		return
	if isValid2(x, y, x1, y1, x2, y2):
		print('YES')
	else:
		print('NO')
	print()

def isValid1(x, x1, x2):
	if x1 <= x and x <= x2:
		return True
	else:
		return False

def isValid2(x, y, x1, y1, x2, y2):
	if isValid1(x, x1, x2) and isValid1(y, y1, y2):
		return True
	else:
		return False
t = int(input())
for i in range(0, t):
	inpLine1 = list(map(lambda x: int(x), input().split()))
	inpLine2 = list(map(lambda x: int(x), input().split()))
	solve(inpLine1[0], inpLine1[1], inpLine1[2], inpLine1[3], inpLine2[0], inpLine2[1], inpLine2[2], inpLine2[3], inpLine2[4], inpLine2[5])


t = int(input())
for i in range(t):
	(a, b, c, d) = list(map(int, input().split()))
	(x, y, x1, y1, x2, y2) = list(map(int, input().split()))
	yex = 0
	yey = 0
	if a > b:
		yex = -1 * (a - b)
	elif b > a:
		yex = b - a
	elif a != 0:
		if x1 <= x - 1 or x2 >= x + 1:
			temp = 2
		else:
			print('No')
			continue
	if c > d:
		yey = -1 * (c - d)
	elif c < d:
		yey = d - c
	elif c != 0:
		if y1 <= y - 1 or y2 >= y + 1:
			temp = 2
		else:
			print('No')
			continue
	x += yex
	y += yey
	if x >= x1 and x <= x2 and (y <= y2) and (y >= y1):
		print('Yes')
	else:
		print('No')


def read():
	return list(map(int, input().split()))
(ntc,) = read()
for tc in range(ntc):
	(a, b, c, d) = read()
	dxn = a
	dxp = b
	dyn = c
	dyp = d
	(x, y, x1, y1, x2, y2) = read()
	if x1 <= x + dxp - dxn <= x2 and y1 <= y - dyn + dyp <= y2 and (x2 - x1 >= min(1, max(dxn, dxp))) and (y2 - y1 >= min(1, max(dyn, dyp))):
		print('YES')
	else:
		print('NO')


def solve(steps, x, y, x1, y1, x2, y2):
	if abs(x1 - x2) == 0 and (steps[0] or steps[1]):
		return False
	if abs(y1 - y2) == 0 and (steps[2] or steps[3]):
		return False
	u = steps[1] - steps[0] + x
	v = steps[3] - steps[2] + y
	return x1 <= u <= x2 and y1 <= v <= y2
t = int(input())
for _ in range(t):
	steps = list(map(int, input().split()))
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	if solve(steps, x, y, x1, y1, x2, y2):
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	ch = input()
	ch2 = input()
	L = [int(i) for i in ch.split()]
	L2 = [int(i) for i in ch2.split()]
	a = L[0]
	b = L[1]
	c = L[2]
	d = L[3]
	x = L2[0]
	y = L2[1]
	x1 = L2[2]
	y1 = L2[3]
	x2 = L2[4]
	y2 = L2[5]
	test = x + (b - a) in range(x1, x2 + 1) and y + (d - c) in range(y1, y2 + 1) and (x in range(x1, x2 + 1)) and (y in range(y1, y2 + 1))
	if b - a == 0 and b != 0:
		if x + 1 not in range(x1, x2 + 1) and x - 1 not in range(x1, x2 + 1):
			test = False
	if d - c == 0 and d != 0:
		if y + 1 not in range(y1, y2 + 1) and y - 1 not in range(y1, y2 + 1):
			test = False
	if test:
		print('YES')
	else:
		print('NO')


T = int(input())
for i in range(T):
	(a, b, c, d) = map(int, input().split())
	s = input().split()
	u = int(s[0])
	v = int(s[1])
	(x1, y1, x2, y2) = list(map(int, s[2:]))
	moves = a + b + c + d
	u += b - a
	v += d - c
	if a + b > 0 and x1 == x2:
		print('No')
	elif c + d > 0 and y1 == y2:
		print('No')
	elif u >= x1 and u <= x2 and (v >= y1) and (v <= y2):
		print('YES')
	else:
		print('NO')


import sys
RI = lambda : [int(x) for x in sys.stdin.readline().split()]
ri = lambda : sys.stdin.readline().strip()

def input():
	return sys.stdin.readline().strip()

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]

def list4d(a, b, c, d, e):
	return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]

def ceil(x, y=1):
	return int(-(-x // y))

def INT():
	return int(input())

def MAP():
	return map(int, input().split())

def LIST(N=None):
	return list(MAP()) if N is None else [INT() for i in range(N)]

def Yes():
	print('Yes')

def No():
	print('No')

def YES():
	print('Yes')

def NO():
	print('No')
INF = 10 ** 18
MOD = 10 ** 9 + 7
for _ in range(int(ri())):
	(a, b, c, d) = RI()
	(x, y, x1, y1, x2, y2) = RI()
	l = x - x1
	r = x2 - x
	if not x1 <= x <= x2:
		NO()
		continue
	if not y1 <= y <= y2:
		NO()
		continue
	if x1 == x2 and (a > 0 or b > 0):
		NO()
		continue
	if y1 == y2 and (c > 0 and d > 0):
		NO()
		continue
	minn = min(a, b)
	if b >= a:
		if not x + b - a <= x2:
			NO()
			continue
	elif not x - (a - b) >= x1:
		NO()
		continue
	a = c
	b = d
	x1 = y1
	x2 = y2
	x = y
	minn = min(a, b)
	if b >= a:
		if not x + b - a <= x2:
			NO()
			continue
	elif not x - (a - b) >= x1:
		NO()
		continue
	YES()


hm = int(input())
while hm:
	hm -= 1
	(a, b, c, d) = [int(x) for x in input().split(' ')]
	(x, y, x1, y1, x2, y2) = [int(x) for x in input().split(' ')]
	if (x1 <= x - a + b <= x2 and (x1 < x2 or a + b == 0)) and (y1 <= y - c + d <= y2 and (y1 < y2 or c + d == 0)):
		print('Yes')
	else:
		print('No')


for _ in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	fx = x - a + b
	if a == b and x == x1 == x2 and (a != 0):
		print('NO')
		continue
	if c == d and y == y1 == y2 and (c != 0):
		print('NO')
		continue
	fy = y - c + d
	print('YES' if x1 <= fx <= x2 and y1 <= fy <= y2 else 'NO')


from itertools import permutations
for _ in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	ans = 'Yes'
	if x - (a - b) < x1:
		ans = 'No'
	if x + (b - a) > x2:
		ans = 'No'
	if y - (c - d) < y1:
		ans = 'No'
	if y + (d - c) > y2:
		ans = 'No'
	if x == x1 and x == x2:
		if a or b:
			ans = 'No'
	if y == y1 and y == y2:
		if c or d:
			ans = 'No'
	print(ans)


def solve():
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	if not x1 <= x <= x2 or not y1 <= y <= y2:
		print('NO')
		return
	dx = b - a
	dy = d - c
	if a + b != 0 and x == x1 and (x == x2):
		print('NO')
		return
	if c + d != 0 and y == y1 and (y == y2):
		print('NO')
		return
	if not x1 <= x + dx <= x2 or not y1 <= y + dy <= y2:
		print('NO')
	else:
		print('YES')
t = int(input())
for _ in range(t):
	solve()


for _ in range(int(input())):
	(a, b, c, d) = [int(s) for s in input().split()]
	(x, y, x1, y1, x2, y2) = [int(s) for s in input().split()]
	flag = False
	xans = x - a + b
	yans = y - c + d
	if xans >= x1 and xans <= x2 and (yans >= y1) and (yans <= y2):
		flag = True
	else:
		print('NO')
		continue
	if (a != 0 or b != 0) and x1 == x2:
		flag = False
	if (c != 0 or d != 0) and y1 == y2:
		flag = False
	if flag:
		print('YES')
	else:
		print('NO')


n = int(input())
for _ in range(n):
	(left, right, down, up) = [int(x) for x in input().split()]
	(x, y, xmin, ymin, xmax, ymax) = [int(x) for x in input().split()]
	hori = right - left
	ver = up - down
	if xmin == xmax and left + right > 0:
		print('No')
	elif ymin == ymax and down + up > 0:
		print('No')
	elif xmin <= x + hori <= xmax and ymin <= y + ver <= ymax:
		print('Yes')
	else:
		print('No')


z = int(input())
for i in range(z):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	f = x
	e = y
	x -= a
	x += b
	y -= c
	y += d
	if x1 <= x and x2 >= x and (y1 <= y) and (y2 >= y):
		answer = 'Yes'
	else:
		answer = 'No'
	if x1 == x2 and (a != 0 or b != 0):
		answer = 'No'
	if y1 == y2 and (c != 0 or d != 0):
		answer = 'No'
	print(answer)


for i in range(int(input())):
	l1 = list(map(int, input().split()))
	l2 = list(map(int, input().split()))
	x = l2[0]
	y = l2[1]
	x -= l1[0]
	x += l1[1]
	y -= l1[2]
	y += l1[3]
	if l1[0] + l1[1] > 0 and l2[2] == l2[4]:
		print('No')
	elif l1[2] + l1[3] > 0 and l2[3] == l2[5]:
		print('No')
	elif l2[2] <= x <= l2[4] and l2[3] <= y <= l2[5]:
		print('Yes')
	else:
		print('No')


for _ in range(int(input())):
	(left, right, down, up) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	left_max = x - x1
	right_max = x2 - x
	down_max = y - y1
	up_max = y2 - y
	key_lr = False
	key_du = False
	if left > right:
		left = left - right
		right = 0
	elif right > left:
		right = right - left
		left = 0
	elif x1 != x or x2 != x:
		left = 0
		right = 0
	if left == 0:
		if right <= right_max:
			key_lr = True
	elif left <= left_max:
		key_lr = True
	if down > up:
		down = down - up
		up = 0
	elif up > down:
		up = up - down
		down = 0
	elif y1 != y or y2 != y:
		down = 0
		up = 0
	if down == 0:
		if up <= up_max:
			key_du = True
	elif down <= down_max:
		key_du = True
	if key_lr and key_du:
		print('YES')
	else:
		print('NO')


t = int(input())
cases = []
for _ in range(t):
	f = [int(i) for i in input().split()]
	s = [int(i) for i in input().split()]
	cases.append([f, s])
for (f, s) in cases:
	a = f[0]
	b = f[1]
	c = f[2]
	d = f[3]
	x = s[0]
	y = s[1]
	x1 = s[2]
	y1 = s[3]
	x2 = s[4]
	y2 = s[5]
	a_b = b - a
	c_d = d - c
	x_ = x + a_b
	y_ = y + c_d
	if x_ < x1 or x_ > x2 or y_ < y1 or (y_ > y2):
		print('No')
		continue
	if a_b == 0 and a != 0 and (x1 == x2):
		print('No')
		continue
	if c_d == 0 and c != 0 and (y1 == y2):
		print('No')
		continue
	print('Yes')


t = int(input())
for i in range(t):
	(l, r, d, u) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	fx = x - l + r
	fy = y - d + u
	if x1 == x2 and y1 == y2 and (l + r + u + d > 0):
		print('No')
	elif x1 == x2 and l + r > 0:
		print('No')
	elif y1 == y2 and u + d > 0:
		print('No')
	elif x1 <= fx <= x2 and y1 <= fy <= y2:
		print('Yes')
	else:
		print('No')


def solve(s):
	amount = 0
	while s >= 10:
		extra = s // 10
		paid = extra * 10
		amount += paid
		s = s - paid + extra
	return amount + s
t = int(input())
for i in range(t):
	(a, b, c, d) = map(int, input().split(' '))
	(x, y, x1, y1, x2, y2) = map(int, input().split(' '))
	end_x = x + b - a
	end_y = y + d - c
	if a + b > 0 and x1 == x2:
		print('No')
	elif c + d > 0 and y1 == y2:
		print('No')
	elif x1 <= end_x <= x2 and y1 <= end_y <= y2:
		print('Yes')
	else:
		print('No')


T = int(input())
for i in range(T):
	(p, q, r, s) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	x += q - p
	y += s - r
	if p + q > 0 and x1 == x2:
		print('No')
	elif r + s > 0 and y1 == y2:
		print('No')
	elif x1 <= x <= x2 and y1 <= y <= y2:
		print('Yes')
	else:
		print('No')


t = int(input())
s = 0
l1 = []
while s < t:
	i = 0
	j = 0
	k = 0
	m = 0
	ch = input()
	liste = ch.split(' ')
	ch2 = input()
	l2 = ch2.split(' ')
	a = int(liste[0])
	b = int(liste[1])
	c = int(liste[2])
	d = int(liste[3])
	x = int(l2[0])
	y = int(l2[1])
	x1 = int(l2[2])
	y1 = int(l2[3])
	x2 = int(l2[4])
	y2 = int(l2[5])
	if (x1 == x2 and x2 == x) and (a != 0 or b != 0):
		r = 0
	else:
		x += b - a
		if x <= x2 and x >= x1:
			r = 1
		else:
			r = 0
	if (y1 == y2 and y2 == y) and (c != 0 or d != 0):
		z = 0
	else:
		y += d - c
		if y <= y2 and y >= y1:
			z = 1
		else:
			z = 0
	if z == 0 or r == 0:
		l1.append('No')
	else:
		l1.append('Yes')
	s += 1
for p in range(len(l1)):
	print(l1[p])


def can(array_m, array_c):
	a = array_m[0]
	b = array_m[1]
	c = array_m[2]
	d = array_m[3]
	u = array_c[0]
	v = array_c[1]
	x1 = array_c[2]
	y1 = array_c[3]
	x2 = array_c[4]
	y2 = array_c[5]
	answer = 'Yes'
	if u + b - a < x1 or u + b - a > x2 or v + d - c > y2 or (v + d - c < y1):
		return 'No'
	if a != 0 and b != 0:
		if u + 1 > x2 and u - 1 < x1:
			return 'No'
	if c != 0 and d != 0:
		if v - 1 < y1 and v + 1 > y2:
			return 'No'
	if a == 0:
		if u + 1 > x2 and b != 0:
			return 'No'
	if b == 0:
		if u - 1 < x1 and a != 0:
			return 'No'
	if c == 0:
		if d != 0 and v + 1 > y2:
			return 'No'
	if d == 0:
		if c != 0 and v - 1 < y1:
			return 'No'
	return answer
t = int(input())
array = []
for i in range(t):
	a = list(map(int, input().split(' ')))
	b = list(map(int, input().split(' ')))
	array.append([a, b])
for c in array:
	print(can(c[0], c[1]))


t = int(input())
for i in range(t):
	(a, b, c, d) = map(int, input().split())
	(x, y, x1, y1, x2, y2) = map(int, input().split())
	status = 0
	right = b - a
	up = d - c
	if x1 == x and x2 == x and (a != 0) and (status != 1) or (x1 == x and x2 == x and (b != 0) and (status != 1)):
		print('No')
		status = 1
	if y1 == y and y2 == y and (c != 0) and (status != 1) or (y1 == y and y2 == y and (d != 0) and (status != 1)):
		print('No')
		status = 1
	if right > 0:
		if x + right > x2 and status != 1:
			print('No')
			status = 1
	elif x + right < x1 and status != 1:
		print('No')
		status = 1
	if up > 0:
		if y + up > y2 and status != 1:
			print('No')
			status = 1
	elif y + up < y1 and status != 1:
		print('No')
		status = 1
	if status == 0:
		print('Yes')