You have a board represented as a grid with $2 \times n$ cells.

The first $k_1$ cells on the first row and first $k_2$ cells on the second row are colored in white. All other cells are colored in black.

You have $w$ white dominoes ($2 \times 1$ tiles, both cells are colored in white) and $b$ black dominoes ($2 \times 1$ tiles, both cells are colored in black).

You can place a white domino on the board if both board's cells are white and not occupied by any other domino. In the same way, you can place a black domino if both cells are black and not occupied by any other domino.

Can you place all $w + b$ dominoes on the board if you can place dominoes both horizontally and vertically?


-----Input-----

The first line contains a single integer $t$ ($1 \le t \le 3000$) — the number of test cases.

The first line of each test case contains three integers $n$, $k_1$ and $k_2$ ($1 \le n \le 1000$; $0 \le k_1, k_2 \le n$).

The second line of each test case contains two integers $w$ and $b$ ($0 \le w, b \le n$).


-----Output-----

For each test case, print YES if it's possible to place all $w + b$ dominoes on the board and NO, otherwise.

You may print every letter in any case you want (so, for example, the strings yEs, yes, Yes and YES are all recognized as positive answer).


-----Examples-----

Input
5
1 0 1
1 0
1 1 1
0 0
3 0 0
1 3
4 3 1
2 2
5 4 3
3 1
Output
NO
YES
NO
YES
YES


-----Note-----

In the first test case, $n = 1$, $k_1 = 0$ and $k_2 = 1$. It means that $2 \times 1$ board has black cell $(1, 1)$ and white cell $(2, 1)$. So, you can't place any white domino, since there is only one white cell.

In the second test case, the board of the same size $2 \times 1$, but both cell are white. Since $w = 0$ and $b = 0$, so you can place $0 + 0 = 0$ dominoes on the board.

In the third test case, board $2 \times 3$, but fully colored in black (since $k_1 = k_2 = 0$), so you can't place any white domino.

In the fourth test case, cells $(1, 1)$, $(1, 2)$, $(1, 3)$, and $(2, 1)$ are white and other cells are black. You can place $2$ white dominoes at positions $((1, 1), (2, 1))$ and $((1, 2), (1, 3))$ and $2$ black dominoes at positions $((1, 4), (2, 4))$ $((2, 2), (2, 3))$.

Source: codeforces | Difficulty: EASY
Tags: Combinatorics

Mathematics

Constructive algorithms


Solutions:
for _ in range(int(input())):
	(n, k1, k2) = map(int, input().split())
	(w, b) = map(int, input().split())
	if k1 + k2 >= 2 * w and 2 * n - (k1 + k2) >= 2 * b:
		print('YES')
	else:
		print('NO')


import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush
from math import *
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, insort
from time import perf_counter
from fractions import Fraction
import copy
from copy import deepcopy
import time
starttime = time.time()
mod = int(pow(10, 9) + 7)
mod2 = 998244353

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

def out(*var, end='\n'):
	sys.stdout.write(' '.join(map(str, var)) + end)

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)]
try:
	sys.stdin = open('input.txt', 'r')
except:
	pass

def pmat(A):
	for ele in A:
		print(*ele, end='\n')
for _ in range(L()[0]):
	(n, k1, k2) = L()
	(w, b) = L()
	z1 = min(k1, k2)
	z2 = (k1 + k2 - z1 * 2) // 2
	if z1 + z2 < w:
		print('NO')
	else:
		k1 = n - k1
		k2 = n - k2
		z1 = min(k1, k2)
		z2 = (k1 + k2 - z1 * 2) // 2
		if z1 + z2 < b:
			print('NO')
		else:
			print('YES')
endtime = time.time()


for i in range(int(input())):
	(n, k1, k2) = map(int, input().split())
	(w, b) = map(int, input().split())
	s = n * 2
	z = k1 + k2
	if w * 2 <= z and b * 2 <= s - z:
		print('YES')
	elif w == 0 and b == 0:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	nkk = list(map(int, input().split()))
	wb = list(map(int, input().split()))
	n = nkk[0]
	k1 = nkk[1]
	k2 = nkk[2]
	w = wb[0]
	b = wb[1]
	maxWhite = min(k1, k2)
	maxBlack = n - max(k1, k2)
	left = int(abs(k1 - k2) / 2)
	maxWhite += left
	maxBlack += left
	if w <= maxWhite and b <= maxBlack:
		print('YES')
	else:
		print('NO')


import math
t = int(input())
for _ in range(t):
	(n, k1, k2) = list(map(int, input().split()))
	(w, b) = list(map(int, input().split()))
	diff = abs(k1 - k2)
	maxW = min(k1, k2) + math.floor(diff / 2.0)
	maxB = n - max(k1, k2) + math.floor(diff / 2.0)
	if w <= maxW and b <= maxB:
		print('YES')
	else:
		print('NO')


def board(n, k1, k2, w, b):
	w1 = min(k1, k2)
	b1 = n - max(k1, k2)
	sub = abs(k1 - k2) // 2
	w1 += sub
	b1 += sub
	if w <= w1 and b <= b1:
		print('YES')
	else:
		print('NO')
t = int(input())
for i in range(0, t):
	(n, k1, k2) = list(map(int, input().strip().split()))
	(w, b) = list(map(int, input().strip().split()))
	board(n, k1, k2, w, b)


t = int(input())

def f(w, b, n, k1, k2):
	d = 0
	d1 = 0
	if k1 > k2:
		d += k2
		d += (k1 - k2) // 2
	elif k1 < k2:
		d += k1
		d += (k2 - k1) // 2
	elif k1 == k2:
		d += k1
	b1 = n - k1
	b2 = n - k2
	if b1 > b2:
		d1 += b2
		d1 += (b1 - b2) // 2
	elif b1 < b2:
		d1 += b1
		d1 += (b2 - b1) // 2
	elif b1 == b2:
		d1 += b1
	if d1 >= b and d >= w:
		return 'YES'
	else:
		return 'NO'
l = []
for i in range(t):
	(n, k1, k2) = map(int, input().split())
	(w, b) = map(int, input().split())
	l.append(f(w, b, n, k1, k2))
for i in range(t):
	print(l[i])


x = int(input())
l = []
for i in range(x):
	(n, k1, k2) = map(int, input().split())
	(w, b) = map(int, input().split())
	if k1 + k2 >= 2 * w and 2 * n >= 2 * b + k1 + k2:
		l.append('YES')
	else:
		l.append('NO')
for i in range(x):
	print(l[i])


import math
import operator as op
from functools import reduce
from collections import defaultdict
from math import comb
from sys import stdout
NO = 'NO'
YES = 'YES'
MOD = 1000000007

def input_int():
	return int(input())

def input_list():
	return input().split(' ')

def input_list_int():
	return list(map(int, input_list()))

def z_func(s):
	n = len(s)
	z = [0] * n
	l = r = 0
	for i in range(1, n):
		if r >= i:
			z[i] = min(z[i - l], r - i + 1)
		while z[i] + i < n and s[z[i]] == s[z[i] + i]:
			z[i] += 1
		if i + z[i] - 1 > r:
			l = i
			r = i + z[i] - 1
	return z
global_ans = []

def pr(a):
	global_ans.append(a)

def solve():
	(n, k1, k2) = input_list_int()
	(w, b) = input_list_int()
	t1 = n - k1
	t2 = n - k2
	wc = k1 // 2
	wc += k2 // 2
	if k1 % 2 == 1 and k2 % 2 == 1:
		wc += 1
	bc = t1 // 2
	bc += t2 // 2
	if t1 % 2 == 1 and t2 % 2 == 1:
		bc += 1
	if wc >= w and bc >= b:
		pr(YES)
	else:
		pr(NO)
query_count = 1
query_count = input_int()
while query_count:
	query_count -= 1
	solve()
for global_ans_line in global_ans:
	print(global_ans_line)


import sys, io, os, math
from math import ceil, log, gcd, sqrt
from itertools import permutations
import operator
mod = 1000000007
mod1 = 998244353

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

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

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

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

def flush():
	return stdout.flush()

def power_two(x):
	return 1 << x

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

def solve():
	(n, k1, k2) = mulinp()
	(w, b) = mulinp()
	cells = n + n
	white = k1 + k2
	black = cells - white
	(w, b) = (w + w, b + b)
	if white - w >= 0 and black - b >= 0:
		print('YES')
		return
	print('NO')
	return

def main():
	tc = intinp()
	while tc:
		solve()
		tc -= 1
main()


t = eval(input())
for i in range(t):
	(n, k1, k2) = map(int, input().split())
	(w, b) = map(int, input().split())
	if w * 2 <= k1 + k2 and b * 2 <= n * 2 - (k1 + k2):
		print('YES')
	else:
		print('NO')


def find(n, k1, k2, w, b):
	return 'NYOE S'[min(k1, k2) + abs(k1 - k2) // 2 >= w and min(n - k1, n - k2) + abs(k1 - k2) // 2 >= b::2]
for _ in [0] * int(input()):
	(n, k1, k2) = map(int, input().split())
	(w, b) = map(int, input().split())
	print(find(n, k1, k2, w, b))


import sys
from collections import *
from heapq import *
import math
import bisect

def input():
	return sys.stdin.readline()
for _ in range(int(input())):
	(n, k1, k2) = map(int, input().split())
	(w, b) = map(int, input().split())
	minn = min(k1, k2)
	maxx = max(k1, k2)
	blck = 2 * n - (k1 + k2)
	w -= minn
	w -= (maxx - minn) // 2
	b -= blck // 2
	if w > 0 or b > 0:
		print('NO')
	else:
		print('YES')


import sys
from sys import stdin

def solve(N, K1, K2, W, B):
	x1 = min(K1, K2)
	x2 = abs(K1 - K2)
	w_max = x1 + x2 / 2
	y1 = N - max(K1, K2)
	b_max = y1 + x2 / 2
	if W <= w_max and B <= b_max:
		return 'YES'
	else:
		return 'NO'

def run():
	out = ''
	T = int(input())
	for i in range(T):
		(N, K1, K2) = [int(x) for x in stdin.readline().split()]
		(W, B) = [int(x) for x in stdin.readline().split()]
		print(solve(N, K1, K2, W, B))
run()


t = int(input())
for _ in range(t):
	(n, k1, k2) = list(map(int, input().split()))
	(w, b) = list(map(int, input().split()))
	odd_w = w & 1
	odd_b = b & 1
	if odd_w ^ odd_w:
		print('NO')
	else:
		whites = k1 + k2
		blacks = 2 * n - k1 - k2
		ans = 'YES' if w * 2 <= whites and b * 2 <= blacks else 'NO'
		print(ans)


import math

def get_ans(n, k1, k2, w, b):
	temp_w = min(k1, k2)
	temp_w += math.floor(abs(k2 - k1) / 2)
	b1 = n - k1
	b2 = n - k2
	temp_b = min(b1, b2)
	temp_b += math.floor(abs(b2 - b1) / 2)
	return temp_w >= w and temp_b >= b
test_cases = int(input())
ans = []
for i in range(test_cases):
	(n, k1, k2) = list(map(int, input().split()))
	(w, b) = list(map(int, input().split()))
	ans.append(get_ans(n, k1, k2, w, b))
for i in ans:
	if i:
		print('YES')
	else:
		print('NO')


t = int(input())
while t > 0:
	(n, k1, k2) = map(int, input().split())
	(w, b) = map(int, input().split())
	if b <= (n - k1 + (n - k2)) / 2 and w <= (k1 + k2) / 2:
		print('YES')
	else:
		print('NO')
	t -= 1


t = int(input())
for i in range(t):
	(n, k1, k2) = map(int, input().split())
	(w, b) = map(int, input().split())
	wp = min(k1, k2) + abs(k1 - k2) // 2
	bp = min(n - k1, n - k2) + abs(n - k1 - n + k2) // 2
	if wp >= w and bp >= b:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(n, k1, k2) = [int(x) for x in input().split()]
	(w, b) = [int(x) for x in input().split()]
	white = False
	if k1 % 2 == k2 % 2:
		if 2 * w <= k1 + k2 and 2 * b <= 2 * n - k1 - k2:
			print('YES')
		else:
			print('NO')
	elif 2 * w <= k1 + k2 - 1 and 2 * b <= 2 * n - k1 - k2 - 1:
		print('YES')
	else:
		print('NO')


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

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

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

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

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

def BI():
	return sys.stdin.buffer.readline().rstrip()

def SI():
	return sys.stdin.buffer.readline().rstrip().decode()
inf = 10 ** 16
md = 10 ** 9 + 7

def mx_cnt(x, y):
	if x < y:
		(x, y) = (y, x)
	ans = y + (x - y) // 2
	return ans

def ok():
	return w <= mx_cnt(x, y) and b <= mx_cnt(n - x, n - y)
for _ in range(II()):
	(n, x, y) = LI()
	(w, b) = LI()
	print('YES' if ok() else 'NO')


import sys
input = sys.stdin.readline
(inp, ip) = (lambda : int(input()), lambda : [int(w) for w in input().split()])
for _ in range(inp()):
	(n, k1, k2) = ip()
	(w, b) = ip()
	x = k1 + k2
	y = 2 * n - x
	ans = 'YES'
	if w > x // 2:
		ans = 'NO'
	if b > y // 2:
		ans = 'NO'
	print(ans)


from sys import stdin, stdout
import math
import math

def ii():
	return int(stdin.readline())

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

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

def si():
	return stdin.readline()
for _ in range(ii()):
	(n, k1, k2) = mi()
	(w, b) = mi()
	if w == 0 and b == 0:
		print('YES')
	elif w > 0 and b == 0:
		if 2 * w <= k1 + k2:
			print('YES')
		else:
			print('NO')
	elif w == 0 and b > 0:
		if 2 * n - k1 - k2 >= 2 * b:
			print('YES')
		else:
			print('NO')
	elif w > 0 and b > 0:
		if 2 * w <= k1 + k2 and 2 * n - k1 - k2 >= 2 * b:
			print('YES')
		else:
			print('NO')


t = int(input())
answer = []
for i in range(t):
	(n, k1, k2) = map(int, input().split())
	(w, b) = map(int, input().split())
	if k1 + k2 >= 2 * w and 2 * n - (k1 + k2) >= 2 * b:
		answer.append('YES')
	else:
		answer.append('NO')
print('\n'.join(answer))


import bisect
import math
import itertools
import sys
alpha = 'abcdefghijklmnopqrstuvwxyz'
inf = 1e+17
mod = 10 ** 9 + 7

def solve(n, k1, k2, w, b):
	if (k1 + k2) // 2 >= w and (n - k1 + (n - k2)) // 2 >= b:
		return 'YES'
	return 'NO'
	pass
t = int(input())
ans = []
for _ in range(t):
	(n, k1, k2) = map(int, input().split())
	(w, b) = map(int, input().split())
	ans.append(solve(n, k1, k2, w, b))
for test in ans:
	print(test)


tralis = int(input())
answer_list = []
for d in range(tralis):
	numbers_1 = input().split()
	numbers_2 = input().split()
	n = int(numbers_1[0])
	k_1 = int(numbers_1[1])
	k_2 = int(numbers_1[2])
	w = int(numbers_2[0])
	b = int(numbers_2[1])
	geretor = None
	if k_1 >= k_2:
		geretor = k_1
	else:
		geretor = k_2
	diff = abs(k_2 - k_1)
	possible_w = geretor - diff + diff // 2
	b_1 = n - k_1
	b_2 = n - k_2
	geretor_b = None
	if b_1 >= b_2:
		geretor_b = b_1
	else:
		geretor_b = b_2
	diff_b = abs(k_2 - k_1)
	possible_b = geretor_b - diff_b + diff_b // 2
	if possible_w >= w and possible_b >= b:
		answer_list.append('YES')
	else:
		answer_list.append('NO')
for s in answer_list:
	print(s)


d = int(input())
while d != 0:
	d = d - 1
	(n, k, c) = map(int, input().split())
	(w, b) = map(int, input().split())
	if 2 * b > 2 * n - k - c:
		print('NO')
	elif 2 * w > k + c:
		print('NO')
	else:
		print('YES')


tc = int(input())
while tc > 0:
	(n, k1, k2) = map(int, input().strip().split())
	(w, b) = map(int, input().strip().split())
	k3 = n - k1
	k4 = n - k2
	mn = min(k1, k2)
	k1 -= mn
	k1 = k1 // 2
	k2 -= mn
	k2 = k2 // 2
	mn2 = min(k3, k4)
	k3 -= mn2
	k3 = k3 // 2
	k4 -= mn2
	k4 = k4 // 2
	if mn + k1 + k2 >= w and mn2 + k3 + k4 >= b:
		print('YES\n')
	else:
		print('NO')
	tc -= 1


import sys
input = sys.stdin.readline

def solve():
	if w + b > n:
		return 'NO'
	if k1 + k2 < w * 2:
		return 'NO'
	if 2 * n - (k1 + k2) < b * 2:
		return 'NO'
	return 'YES'
t = int(input())
for i in range(t):
	(n, k1, k2) = map(int, input().split())
	(w, b) = map(int, input().split())
	print(solve())


for _ in range(int(input())):
	(n, c, d) = map(int, input().split())
	w = c + d
	b = 2 * n - w
	(x, y) = map(int, input().split())
	if 2 * x <= w and 2 * y <= b:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(n, k1, k2) = [int(i) for i in input().split()]
	(w, b) = [int(i) for i in input().split()]
	wcount = 0
	wflag = 0
	bcount = 0
	bflag = 0
	if k1 == k2:
		if w <= k1:
			wflag = 1
			wcount = k1
		if b <= n - k1:
			bflag = 1
			bcount = n - k1
	else:
		if k1 > k2:
			wcount = k2
			wcount += (k1 - k2) // 2
			bcount = n - k1
			bcount += (k1 - k2) // 2
		else:
			wcount = k1
			wcount += (k2 - k1) // 2
			bcount = n - k2
			bcount += (k2 - k1) // 2
		if wcount >= w:
			wflag = 1
		if bcount >= b:
			bflag = 1
	if wflag and bflag:
		print('YES')
	else:
		print('NO')


try:
	for _ in range(int(input())):
		(n, k1, k2) = map(int, input().split())
		(w, b) = map(int, input().split())
		if 2 * w <= k1 + k2 and 2 * b <= 2 * n - k1 - k2:
			print('Yes')
		else:
			print('No')
except:
	pass


t = int(input())
for i in range(t):
	str1 = input().split()
	str2 = input().split()
	n = int(str1[0])
	k1 = int(str1[1])
	k2 = int(str1[2])
	w = int(str2[0])
	b = int(str2[1])
	x = k1 + k2
	y = 2 * n - x
	if x >= 2 * w and y >= 2 * b:
		print('YES')
	else:
		print('NO')


t = int(input())
data = dict()
s1 = int()
s2 = int()
k1 = int()
k2 = int()
w = int()
b = int()
for i in range(t):
	data[i] = [input().split(), input().split()]
for j in range(len(data)):
	n = int(data[j][0][0])
	k1 = int(data[j][0][1])
	k2 = int(data[j][0][2])
	w = int(data[j][1][0])
	b = int(data[j][1][1])
	if k1 + k2 >= w * 2 and n * 2 - k1 - k2 >= b * 2:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(n, k1, k2) = map(int, input().split())
	(w, b) = map(int, input().split())
	maxW = min(k1, k2) + abs(k1 - k2) // 2
	maxB = n - max(k1, k2) + abs(k1 - k2) // 2
	if maxW >= w and maxB >= b:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(n, k1, k2) = [int(i) for i in input().split()]
	(w, b) = [int(i) for i in input().split()]
	result1 = k1 // 2 + k2 // 2 + (k1 % 2 + k2 % 2) // 2
	(K1, K2) = (n - k1, n - k2)
	result2 = K1 // 2 + K2 // 2 + (K1 % 2 + K2 % 2) // 2
	if result1 >= w and result2 >= b:
		print('YES')
	else:
		print('NO')


from collections import defaultdict, OrderedDict, Counter
from sys import stdin, stdout
from bisect import bisect_left, bisect_right
from queue import Queue, PriorityQueue
from heapq import *
from statistics import *
from math import *
import fractions
import copy
from copy import deepcopy
import sys
import io
sys.setrecursionlimit(10000)
import math
import os
import bisect
import collections
mod = pow(10, 9) + 7
import random
from random import *
from time import time

def ncr(n, r, p=mod):
	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

def normalncr(n, r):
	r = min(r, n - r)
	count = 1
	for i in range(n - r, n + 1):
		count *= i
	for i in range(1, r + 1):
		count //= i
	return count
inf = float('inf')
adj = defaultdict(set)
visited = defaultdict(int)

def addedge(a, b):
	adj[a].add(b)
	adj[b].add(a)

def bfs(v):
	q = Queue()
	q.put(v)
	visited[v] = 1
	while q.qsize() > 0:
		s = q.get_nowait()
		print(s)
		for i in adj[s]:
			if visited[i] == 0:
				q.put(i)
				visited[i] = 1

def dfs(v, visited):
	if visited[v] == 1:
		return
	visited[v] = 1
	print(v)
	for i in adj[v]:
		dfs(i, visited)

def reverse_bisect_right(a, x, lo=0, hi=None):
	if lo < 0:
		raise ValueError('lo must be non-negative')
	if hi is None:
		hi = len(a)
	while lo < hi:
		mid = (lo + hi) // 2
		if x > a[mid]:
			hi = mid
		else:
			lo = mid + 1
	return lo

def reverse_bisect_left(a, x, lo=0, hi=None):
	if lo < 0:
		raise ValueError('lo must be non-negative')
	if hi is None:
		hi = len(a)
	while lo < hi:
		mid = (lo + hi) // 2
		if x >= a[mid]:
			hi = mid
		else:
			lo = mid + 1
	return lo

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

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

def get_str_list():
	return list(input())

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

def input_int():
	return int(input())

def matrix(a, b):
	return [[0 for i in range(b)] for j in range(a)]

def swap(a, b):
	return (b, a)

def find_gcd(l):
	a = l[0]
	for i in range(len(l)):
		a = gcd(a, l[i])
	return a

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

def prime_factors(n):
	while n % 2 == 0:
		return [2] + prime_factors(n // 2)
	sqrta = int(sqrt(n))
	for i in range(3, sqrta + 1, 2):
		if n % i == 0:
			return [i] + prime_factors(n // i)
	return [n]

def p(a):
	if type(a) == str:
		print(a + '\n')
	else:
		print(str(a) + '\n')

def ps(a):
	if type(a) == str:
		print(a)
	else:
		print(str(a))

def kth_no_not_div_by_n(n, k):
	return k + (k - 1) // (n - 1)

def forward_array(l):
	n = len(l)
	stack = []
	forward = [0] * n
	for i in range(len(l) - 1, -1, -1):
		while len(stack) and l[stack[-1]] < l[i]:
			stack.pop()
		if len(stack) == 0:
			forward[i] = len(l)
		else:
			forward[i] = stack[-1]
		stack.append(i)
	return forward

def backward_array(l):
	n = len(l)
	stack = []
	backward = [0] * n
	for i in range(len(l)):
		while len(stack) and l[stack[-1]] < l[i]:
			stack.pop()
		if len(stack) == 0:
			backward[i] = -1
		else:
			backward[i] = stack[-1]
		stack.append(i)
	return backward
nc = 'NO'
yc = 'YES'
ns = 'No'
ys = 'Yes'
t = int(input())
for i in range(t):
	(n, k1, k2) = get_map()
	(w, b) = get_map()
	white = min(k1, k2)
	black = n - max(k1, k2)
	white += abs(k1 - k2) // 2
	black += abs(k1 - k2) // 2
	if w <= white and b <= black:
		print(yc)
	else:
		print(nc)


import sys

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

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

def input():
	return sys.stdin.readline().strip()
for _ in range(int(input())):
	(n, k1, k2) = get_ints()
	(w, b) = get_ints()
	if w == 0 and b == 0:
		print('YES')
	elif 2 * w <= k1 + k2 and b * 2 <= 2 * n - (k1 + k2):
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	(n, k1, k2) = map(int, input().split())
	(wh, bl) = map(int, input().split())
	White = k1 + k2
	Black = 2 * n - White
	if White >= 2 * wh and Black >= 2 * bl:
		print('YES')
	else:
		print('NO')


T = int(input())
for _ in range(T):
	(n, k1, k2) = map(int, input().split())
	(w, b) = map(int, input().split())
	white = min(k1, k2) + abs(k1 - k2) // 2
	black = min(n - k1, n - k2) + abs(n - k1 - (n - k2)) // 2
	if white >= w and black >= b:
		print('YES')
	else:
		print('NO')


n = int(input())
for i in range(n):
	domino = list(map(int, input().split(' ')))
	(w, b) = map(int, input().split(' '))
	bl = domino[0] * 2 - (domino[1] + domino[2])
	wh = domino[1] + domino[2]
	if wh >= w * 2 and b * 2 <= bl:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(n, ka, kb) = map(int, input().split())
	(w, b) = map(int, input().split())
	kaa = n - ka
	kbb = n - kb
	if min(ka, kb) + (max(ka, kb) - min(ka, kb)) // 2 >= w and min(kaa, kbb) + (max(kaa, kbb) - min(kaa, kbb)) // 2 >= b:
		print('YES')
	else:
		print('NO')


from sys import stdin
lst = list(map(int, stdin.read().split()))
s = 0

def inp(n=1):
	global s
	ret = lst[s:s + n]
	s += n
	return ret

def inp1():
	return inp()[0]
t = inp1()
for _ in range(t):
	n = inp1() * 2
	k1 = inp1()
	k2 = inp1()
	total_white = k1 + k2
	total_black = n - total_white
	w = inp1()
	b = inp1()
	if total_white >= w * 2 and total_black >= b * 2:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	(n, k1, k2) = [int(x) for x in str(input()).split(' ')]
	(w, b) = [int(x) for x in str(input()).split(' ')]
	kAdd = k1 + k2
	if w * 2 <= k1 + k2 and b * 2 <= 2 * n - kAdd:
		print('YES')
	else:
		print('NO')


import math
import sys
import itertools
import fractions
wtf = sys.stdin.read()
wtf = wtf.strip().split('\n')
for t in [wtf[i:i + 2] for i in range(1, len(wtf), 2)]:
	(n, k1, k2) = map(int, t[0].split())
	(w, b) = map(int, t[1].split())
	Wk = k1 + k2
	Bk = 2 * n - Wk
	if Wk // 2 >= w and Bk // 2 >= b:
		print('YES')
	else:
		print('NO')


import sys

def rr():
	return sys.stdin.readline().rstrip()
rp = print

def print(*args, **kwargs):
	rp('DBG:# ', *args, **kwargs, file=sys.stderr)

def rri():
	return int(rr())

def rrl():
	return list(map(int, rr().split()))

def rrt():
	return tuple(map(int, rr().split()))

def rrle():
	return (line.rstrip() for line in sys.stdin.readlines())

def rrtl():
	return [tuple(map(int, l.split())) for l in rrle()]
from collections import defaultdict

def mus(d=lambda : 0):
	return defaultdict(lambda : defaultdict(d))

def dd0(d=lambda : 0):
	return defaultdict(d)

def ms(x, y, d=0):
	return [[0] * y for i in range(x)]

def ar(x, d=0):
	return [d] * x

def ppm(m, n=0, x=0, y=0):
	print('\n'.join(('\t'.join((str(m[j][i]) for j in range(y or n))) for i in range(x or n))))

def ppa(a, n):
	print('\t'.join(map(str, a[0:n])))

def ppl(a=0, x=[1]):
	x[0] = a or x[0] + 1
	print('-' + '- -' * 14 + '-# ' + str(x[0] - 2) + ' #-' + '- -' * 14 + '-')

def fltn(a):
	(i for sub in a for i in sub)

def yn(x):
	return 'YES' if x else 'NO'
from itertools import tee
from itertools import accumulate
from itertools import groupby
from itertools import permutations

def pairwise(iterable):
	(a, b) = tee(iterable)
	next(b, None)
	return zip(a, b)

def grp(x, key=None):
	return ((i, sum((1 for _ in g))) for (i, g) in groupby(x, key=key))
import math

def rnar():
	return (*rrl(), rrl())

def rn():
	return (*rrl(),)

def dpp(a, b=''):
	print('#| {} |#:^ {} ^:'.format(a, b))

def str_join(i, sep=' '):
	return sep.join(map(str, i))
MOD17 = 10 ** 9 + 7

def read():
	return (*rrl(), *rrl())

def solve(n, k1, k2, a, b):
	print(n, k1, k2, a, b)
	if a * 2 <= k1 + k2 and b * 2 <= 2 * n - k1 - k2:
		return 'YES'
	else:
		return 'NO'
test_count = rri()
for _ in range(test_count):
	input_data = read()
	result = solve(*input_data)
	rp(result)


import sys
input = lambda : sys.stdin.readline().rstrip()
for _ in range(int(input())):
	(n, k1, k2) = map(int, input().split())
	(w, b) = map(int, input().split())
	(a, c) = (k1, k2)
	w -= min(a, c)
	w -= abs(a - c) // 2
	(a, c) = (n - k1, n - k2)
	b -= min(a, c)
	b -= abs(a - c) // 2
	if w <= 0 and b <= 0:
		print('YES')
	else:
		print('NO')


n = int(input())
for i in range(n):
	(n, k1, k2) = [int(x) for x in input().split()]
	(w, b) = [int(x) for x in input().split()]
	mink = min(k1, k2)
	maxk = max(k1, k2)
	w -= mink + (maxk - mink) // 2
	b -= (maxk - mink) // 2 + (n - maxk)
	if w <= 0 and b <= 0:
		print('YES')
	else:
		print('NO')


from itertools import accumulate as ac
from collections import Counter as cc
from bisect import bisect_left as bsl
from bisect import bisect as bs
from math import factorial as f
from collections import *
from itertools import *
from string import *
from bisect import *
from queue import *
from heapq import *
from math import *
from sys import *
from re import *

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

def zzz():
	return [int(i) for i in fast().split()]
(z, zz) = (input, lambda : list(map(int, z().split())))
(szz, graph, mod, szzz) = (lambda : sorted(zz()), {}, 10 ** 9 + 7, lambda : sorted(zzz()))

def lcd(xnum1, xnum2):
	return xnum1 * xnum2 // gcd(xnum1, xnum2)

def output(answer):
	stdout.write(str(answer))
num = int(z())
for _ in range(num):
	(n, k1, k2) = zzz()
	(w, b) = zzz()
	t1 = (max(k1, k2) - min(k1, k2)) // 2 + min(k1, k2)
	t2 = (max(n - k1, n - k2) - min(n - k1, n - k2)) // 2 + min(n - k1, n - k2)
	if t1 >= w and t2 >= b:
		print('YES')
	else:
		print('NO')


R = lambda : map(int, input().split())
(t,) = R()
exec(t * "n,*a=R();w,b=R();print('NYOE S'[2*w<=sum(a)<=n-b<<1::2]);")


t = int(input())
for i in range(t):
	(n, k1, k2) = list(map(int, input().split()))
	(j1, j2) = (n - k1, n - k2)
	(w, b) = list(map(int, input().split()))
	total = 0
	if k1 == 0:
		total += k2 // 2
	elif k2 == 0:
		total += k1 // 2
	else:
		total += min(k1, k2) + abs(k1 - k2) // 2
	if total < w:
		print('NO')
		continue
	total = 0
	if j1 == 0:
		total += j2 // 2
	elif j2 == 0:
		total += j1 // 2
	else:
		total += min(j1, j2) + abs(j1 - j2) // 2
	if total < b:
		print('NO')
	else:
		print('YES')


def solve():
	(n, wk1, wk2) = [int(v) for v in input().split()]
	(white, black) = [int(v) for v in input().split()]
	bk1 = n - wk1
	bk2 = n - wk2
	for (k1, k2, amt) in [(wk1, wk2, white), (bk1, bk2, black)]:
		mnk = min(k1, k2)
		diffk = abs(k1 - k2)
		amt -= min(mnk, amt)
		if amt and diffk // 2 < amt:
			print('NO')
			return
	print('YES')
t = int(input())
for _ in range(t):
	solve()


import sys
input = sys.stdin.readline

class Problem:

	def __init__(self):
		pass

	def solve(self):
		t = int(input())
		for _ in range(t):
			(n, k1, k2) = map(int, input().split())
			(w, b) = map(int, input().split())
			ans = (k1 + k2) / 2 >= w and n - (k1 + k2) / 2 >= b
			if ans:
				print('YES')
			else:
				print('NO')

def main():
	p = Problem()
	p.solve()
main()


for _ in range(int(input())):
	(n, k1, k2) = map(int, input().split())
	(w, b) = map(int, input().split())
	print('NYOE S'[w <= min(k1, k2) + abs(k1 - k2) // 2 and b <= min(n - k1, n - k2) + abs(k1 - k2) // 2::2])


for _ in range(int(input())):
	s = list(map(int, input().split()))
	a = list(map(int, input().split()))
	if a[0] == 0 and a[1] == 0:
		print('YES')
	elif s[1] + s[2] >= 2 * a[0] and 2 * s[0] - s[1] - s[2] >= 2 * a[1]:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(n, x, y) = map(int, input().split())
	(w, b) = map(int, input().split())
	w -= abs(x - y) // 2
	b -= abs(x - y) // 2
	w -= min(x, y)
	b -= n - max(x, y)
	if w <= 0 and b <= 0:
		print('YES')
	else:
		print('NO')


def windowsillDomino(n, k1, k2, w, b):
	if (k1 + k2) / 2 >= w and (2 * n - (k1 + k2)) / 2 >= b:
		return 'YES'
	else:
		return 'NO'
t = int(input())
solution = []
for i in range(t):
	[n, k1, k2] = list(map(int, input().split()))
	[w, b] = list(map(int, input().split()))
	solution.append(windowsillDomino(n, k1, k2, w, b))
for i in range(t):
	print(solution[i])


import math
import sys
input = sys.stdin.readline
Test = int(input())
for _ in range(Test):
	(n, k1, k2) = map(int, input().split())
	(w, b) = map(int, input().split())
	if 2 * w <= k1 + k2 and 2 * b <= 2 * n - k1 - k2:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	(n, k1, k2) = [int(x) for x in input().split(' ')]
	(w, b) = [int(x) for x in input().split(' ')]
	rw = k1 + k2
	rb = 2 * n - rw
	if rw >= 2 * w and rb >= 2 * b:
		print('YES')
	else:
		print('NO')


def fn(n, k1, k2, w, b):
	if k1 < k2:
		w1 = k1
		b1 = n - k2
	else:
		w1 = k2
		b1 = n - k1
	k = (k2 - k1) // 2 if k2 > k1 else (k1 - k2) // 2
	if w1 + k >= w and b1 + k >= b:
		return 'YES'
	else:
		return 'NO'
a = []
t = int(input())
for i in range(t):
	(n, k1, k2) = input().split()
	(w, b) = input().split()
	n = int(n)
	k1 = int(k1)
	k2 = int(k2)
	w = int(w)
	b = int(b)
	a.append(fn(n, k1, k2, w, b))
for i in a:
	print(i)


t = int(input())
for _ in range(t):
	(n, k1, k2) = map(int, input().split())
	(w, b) = map(int, input().split())
	flag = 1
	x = min(k1, k2)
	x += abs(k1 - k2) // 2
	if x < w:
		flag = 0
	k1 = n - k1
	k2 = n - k2
	x = min(k1, k2)
	x += abs(k1 - k2) // 2
	if x < b:
		flag = 0
	if flag == 1:
		print('YES')
	else:
		print('NO')


def sol():
	(n, k1, k2) = list(map(int, input().strip().split()))
	(w, b) = list(map(int, input().strip().split()))
	w -= min(k1, k2)
	if w > 0:
		x = max(k1, k2) - min(k1, k2)
		if x > 0:
			if w - x / 2 > 0:
				return 'NO'
		else:
			return 'NO'
	k1 = n - k1
	k2 = n - k2
	b -= min(k1, k2)
	if b > 0:
		x = max(k1, k2) - min(k1, k2)
		if x > 0:
			if b - x / 2 > 0:
				return 'NO'
		else:
			return 'NO'
	return 'YES'
for i in range(int(input())):
	print(sol())


for _ in range(int(input())):
	(n, k1, k2) = map(int, input().split())
	(w, b) = map(int, input().split())
	ans = 'yes'
	(w1, w2, b1, b2) = (k1, k2, n - k1, n - k2)
	cw = w1 // 2 + w2 // 2
	if w1 % 2 == 1 and w2 % 2 == 1:
		cw += 1
	cb = b1 // 2 + b2 // 2
	if b1 % 2 == 1 and b2 % 2 == 1:
		cb += 1
	if cw < w or cb < b:
		ans = 'no'
	print(ans)


for _ in range(int(input())):
	(n, k1, k2) = [int(y) for y in input().split()]
	(w, b) = [int(y) for y in input().split()]
	black = False
	white = False
	if (k2 + k1) // 2 >= w:
		white = True
	if (2 * n - k2 - k1) // 2 >= b:
		black = True
	if white and black:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	(n, k1, k2) = map(int, input().split())
	(a, b) = map(int, input().split())
	if abs(k1 + k2) >= 2 * a and n * 2 - k1 - k2 >= 2 * b:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	(n, k1, k2) = map(int, input().split())
	(w, b) = map(int, input().split())
	w1 = min(k1, k2)
	w1 = 2 * w1 + max(k1, k2) - min(k1, k2)
	b1 = min(n - k1, n - k2)
	b1 = 2 * b1 + max(n - k1, n - k2) - min(n - k1, n - k2)
	if w1 >= 2 * w and b1 >= 2 * b:
		print('YES')
	else:
		print('NO')


t = int(input())
Ans = []
for _ in range(t):
	(n, k1, k2) = map(int, input().split())
	(w, b) = map(int, input().split())
	W = min(k1, k2) + abs(k2 - k1) // 2
	k1 = n - k1
	k2 = n - k2
	B = min(k1, k2) + abs(k2 - k1) // 2
	if w <= W and b <= B:
		Ans.append('YES')
	else:
		Ans.append('NO')
for i in range(t):
	print(Ans[i])


T = int(input())
for _ in range(T):
	(n, a, b) = map(int, input().split())
	(white, black) = map(int, input().split())
	if a + b < white * 2 or 2 * n - 2 * black < a + b:
		print('NO')
	elif a + b == white * 2 or 2 * black == 2 * n - a - b:
		if a % 2 == b % 2:
			print('YES')
		else:
			print('NO')
	else:
		print('YES')


t = int(input())
for i in range(t):
	(n, k1, k2) = list(map(int, input().split()))
	(w, b) = list(map(int, input().split()))
	(k1, k2) = (min(k1, k2), max(k1, k2))
	wposs = k1 + (k2 - k1) // 2
	bposs = n - k2 + (k2 - k1) // 2
	if wposs >= w and bposs >= b:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(n, k1, k2) = map(int, input().split())
	(w, b) = map(int, input().split())
	(w0, b0, d) = (min(k1, k2), min(n - k1, n - k2), abs(k1 - k2) // 2)
	print('yes' if w <= w0 + d and b <= b0 + d else 'no')


a = int(input())
s = 0
while s != a:
	s += 1
	(n, k1, k2) = map(int, input().split())
	(w, b) = map(int, input().split())
	if 2 * b > 2 * n - k1 - k2 or 2 * w > k1 + k2:
		print('NO')
	else:
		print('YES')


t = int(input())
for i in range(t):
	A = list(map(int, input().split()))
	(n, k1, k2) = (A[0], A[1], A[2])
	B = list(map(int, input().split()))
	(w, b) = (B[0], B[1])
	s = n * 2
	if (w + b) * 2 > s:
		print('NO')
	else:
		bel = k1 + k2
		cher = s - bel
		n_bel = bel / 2
		n_cher = cher / 2
		if w <= n_bel and b <= n_cher:
			print('YES')
		else:
			print('NO')


import collections
import sys

def localmin():

	def recur(l, low, high, n):
		mid = (low + high) // 2
		while low != high:
			if l[mid] == 0 or l[mid - 1] == 0 or l[mid + 1] == 0:
				mid += 1
				continue
			if mid > 0 and l[mid - 1] < l[mid] or (mid < n - 1 and l[mid] > l[mid + 1]):
				low = mid + 1
				mid = (low + high) // 2
			elif mid < n - 1 and l[mid] < l[mid + 1] or (mid > 0 and l[mid - 1] > l[mid]):
				high = mid
				mid = (low + high) // 2
		return low + 1
	num = int(input())
	l = [0] * num
	for i in range(1, num + 1):
		print('?', i, sep=' ')
		sys.stdout.flush()
		l[int(input()) - 1] = i
		if i == 101:
			break
	return '! ' + str(recur(l, 0, len(l) - 1, len(l) - 1))

def painting():
	num = int(input())
	l = input().split()
	pos = 0
	c = 0
	l1last = ''
	llast = ''
	while pos < num:
		if l[pos] != llast:
			llast = l[pos]
			pos1 = pos + 1
			c += 1
		while pos1 < num and l[pos1] == llast:
			pos1 += 1
		try:
			if pos1 - pos != 1 and l[pos1] != l1last:
				c += 1
				l1last = l[pos1 - 1]
		except:
			return c + 1
		pos = pos1
	return c

def arena():
	case = int(input())
	for _ in range(case):
		num = int(input())
		l = sorted(list(map(int, input().split())))
		(minn, *l) = l
		for (i, v) in enumerate(l):
			if v > minn:
				print(len(l) - i)
				break
		else:
			print(0)

def catcycle():
	case = int(input())
	for _ in range(case):
		(spots, hour) = map(int, input().split())
		if spots % 2:
			a = spots
			b = 1
			hour %= spots * (spots // 2) + spots // 2 - 1
			for i in range(1, hour):
				a -= 1
				if (b + 1) % spots == a:
					b += 2
				else:
					b += 1
				if b > spots:
					b = b % spots
				if a < 1:
					a = spots
			print(b)
		else:
			spot = hour % spots
			print(spot if spot else spots)

def vanyafence():
	(f, maxh) = map(int, input().split())
	res = 0
	for i in input().split():
		if int(i) > maxh:
			res += 1
		res += 1
	return res

def antonanddanik():
	num = input()
	s = input()
	ac = s.count('A')
	dc = s.count('D')
	if dc == ac:
		return 'Friendship'
	return 'Anton' if ac > dc else 'Danik'

def weight():
	(a, b) = map(int, input().split())
	for i in range(1, 10000):
		a *= 3
		b *= 2
		if a > b:
			return i

def petyarain():
	num = int(input())
	l = input().split()
	ans = 0
	for i in range(num):
		c = 1
		for i1 in range(i - 1, -1, -1):
			if int(l[i1]) > int(l[i1 + 1]):
				break
			c += 1
		for i1 in range(i + 1, num):
			if int(l[i1 - 1]) < int(l[i1]):
				break
			c += 1
		ans = max(ans, c)
	return ans

def findcrim():
	(num, inp) = map(int, input().split())
	thed = min(inp - 1, num - inp)
	l = list(map(int, input().split()))
	c = 0
	for i in range(1, thed + 1):
		if l[inp - i - 1] and l[inp + i - 1]:
			c += 2
	if thed == inp - 1:
		c += l[thed * 2 + 1:].count(1)
	else:
		c += l[:inp - thed - 1].count(1)
	return c if not l[inp - 1] else c + 1

def burglarandmatch():
	(maxn, boxs) = map(int, input().split())
	l = sorted([list(map(int, input().split())) for _ in range(boxs)], key=lambda x: x[1], reverse=True)
	ans = 0
	for i in l:
		if maxn - i[0] < 0:
			ans += maxn * i[1]
			break
		ans += i[0] * i[1]
		maxn -= i[0]
	return ans

def caisajump():
	num = int(input()) + 1
	l = [0] + list(map(int, input().split()))
	energy = 0
	ans = 0
	for i in range(num - 1):
		ne = l[i] - l[i + 1]
		energy += ne
		if energy < 0:
			ans -= energy
			energy = 0
	return ans

def tictac():

	def dicide(l):
		black = False
		white = False
		for i in l:
			if i.count('X') == 3:
				if black:
					return False
				black = True
			elif i.count('O') == 3:
				if white:
					return False
				white = True
		for i in range(len(l)):
			bc = 0
			wc = 0
			for i1 in range(len(l)):
				if l[i1][i] == 'X':
					bc += 1
				elif l[i1][i] == 'O':
					wc += 1
			if bc == 3:
				if black:
					return False
				black = True
			elif wc == 3:
				if white:
					return False
				white = True
		bc = 0
		wc = 0
		for i in range(3):
			if l[i][i] == 'X':
				bc += 1
			if l[i][i] == 'O':
				wc += 1
		if bc == 3:
			if black:
				return False
			black = True
		elif wc == 3:
			if white:
				return False
			white = True
		if l[0][2] == 'X' and l[1][1] == 'X' and (l[2][0] == 'X'):
			if black:
				return False
			black = True
		elif l[0][2] == 'O' and l[1][1] == 'O' and (l[2][0] == 'O'):
			if white:
				return False
			white = True
		return False if white and black else True
	num = int(input())
	for _ in range(num):
		xc = 0
		oc = 0
		lar = []
		for i in range(3):
			l = input()
			xc += l.count('X')
			oc += l.count('O')
			lar.append(l)
		if oc > xc or not dicide(lar) or oc < xc - 1:
			print('no')
		else:
			print('yes')
		if _ != num - 1:
			s = input()
from copy import deepcopy

def change(pos, pos1, l, c):
	return l[:pos] + [l[pos][:pos1] + c + l[pos][pos1 + 1:]] + l[pos + 1:]

def tictac1():

	def dicide(l):
		for i in l:
			if i.count('X') == 3:
				return True
			elif i.count('O') == 3:
				return True
		for i in range(len(l)):
			bc = 0
			wc = 0
			for i1 in range(len(l)):
				if l[i1][i] == 'X':
					bc += 1
				elif l[i1][i] == 'O':
					wc += 1
			if bc == 3:
				return True
			elif wc == 3:
				return True
		bc = 0
		wc = 0
		for i in range(3):
			if l[i][i] == 'X':
				bc += 1
			if l[i][i] == 'O':
				wc += 1
		if bc == 3:
			return True
		elif wc == 3:
			return True
		if l[0][2] == 'X' and l[1][1] == 'X' and (l[2][0] == 'X'):
			return True
		elif l[0][2] == 'O' and l[1][1] == 'O' and (l[2][0] == 'O'):
			return True
	his = set()
	todo = [[['...', '...', '...'], 'X']]
	while todo:
		(l, now) = todo.pop()
		tl = tuple(l)
		if tl not in his:
			his.add(tl)
		else:
			continue
		if dicide(l):
			continue
		if now == 'X':
			for i in range(3):
				for i1 in range(3):
					if l[i][i1] == '.':
						todo.append([change(i, i1, l, now), 'O'])
		else:
			for i in range(3):
				for i1 in range(3):
					if l[i][i1] == '.':
						todo.append([change(i, i1, l, now), 'X'])
	n = int(input())
	for i in range(n):
		print('yes' if tuple((input() for _ in range(3))) in his else 'no')
		if i != n - 1:
			input()

def tictac2():

	def dicide(l):
		for i in l:
			if '.' in i:
				break
		else:
			return True
		for i in l:
			if i.count('X') == 3:
				return True
			elif i.count('O') == 3:
				return True
		for i in range(len(l)):
			bc = 0
			wc = 0
			for i1 in range(len(l)):
				if l[i1][i] == 'X':
					bc += 1
				elif l[i1][i] == 'O':
					wc += 1
			if bc == 3:
				return True
			elif wc == 3:
				return True
		bc = 0
		wc = 0
		for i in range(3):
			if l[i][i] == 'X':
				bc += 1
			if l[i][i] == 'O':
				wc += 1
		if bc == 3:
			return True
		elif wc == 3:
			return True
		if l[0][2] == 'X' and l[1][1] == 'X' and (l[2][0] == 'X'):
			return True
		elif l[0][2] == 'O' and l[1][1] == 'O' and (l[2][0] == 'O'):
			return True
	his = set()
	todo = [[['...', '...', '...'], 'X']]
	while todo:
		(l, now) = todo.pop()
		if tuple(l) in his:
			continue
		if dicide(l):
			his.add(tuple(l))
			continue
		if now == 'X':
			for i in range(3):
				for i1 in range(3):
					if l[i][i1] == '.':
						todo.append([change(i, i1, l, now), 'O'])
		else:
			for i in range(3):
				for i1 in range(3):
					if l[i][i1] == '.':
						todo.append([change(i, i1, l, now), 'X'])
	print(his)
	while True:
		s = input()
		if s == 'end':
			break
		print('valid' if tuple([s[:3], s[3:6], s[6:9]]) in his else 'invalid')

def tictac3():
	his = {('OXX', 'O..', 'OX.'), ('X..', 'OXO', 'OXX'), ('O..', '.OX', 'XXO'), ('.OX', 'XXX', 'OO.'), ('XOX', '.XO', 'O.X'), ('OXX', 'O.X', 'OXO'), ('.OX', 'XOX', '.O.'), ('OXX', 'XX.', 'OOO'), ('X.O', 'XOO', 'OXX'), ('X.O', 'OOX', 'OXX'), ('..O', 'XOX', 'O.X'), ('...', 'O.O', 'XXX'), ('.XO', 'OO.', 'XXX'), ('OOO', 'XXO', '.XX'), ('XXX', 'OO.', 'XO.'), ('OOX', '.X.', 'X..'), ('.X.', '.XO', 'OX.'), ('OX.', 'XXX', 'O.O'), ('XXO', 'XXO', '.OO'), ('O.X', 'OXX', 'X.O'), ('OXX', 'XO.', 'OXO'), ('X.O', 'XOX', 'O..'), ('..X', 'OOO', 'X.X'), ('O.X', 'OXO', 'OXX'), ('.O.', 'XO.', 'XOX'), ('OXX', '.OO', 'XXO'), ('.O.', 'XOX', 'XO.'), ('XXX', 'O..', 'OOX'), ('XXX', 'O..', 'XOO'), ('.XO', '.XO', 'X.O'), ('X..', 'XO.', 'X.O'), ('O.O', '.XO', 'XXX'), ('.X.', 'OX.', '.XO'), ('.XX', 'OXO', 'XO.'), ('.XX', 'OXX', 'OOO'), ('X.O', 'XXX', 'O.O'), ('OOX', '.OX', 'XXO'), ('..X', 'OOX', 'OXX'), ('.XO', 'XXX', 'OO.'), ('.OO', 'XO.', 'XXX'), ('XXX', 'O.O', 'X.O'), ('XXO', '..O', '.XO'), ('.OX', 'OX.', 'XXO'), ('XXO', 'X..', 'XOO'), ('OXO', 'X.O', 'XXO'), ('XOX', 'XO.', 'OOX'), ('XO.', 'XO.', 'X..'), ('XOX', 'OX.', '.OX'), ('OOX', '.XO', 'XX.'), ('XXX', '..O', 'OOX'), ('XXX', '..O', 'XOO'), ('X.X', 'XOX', 'OOO'), ('XOO', '..O', 'XXX'), ('OOX', '..O', 'XXX'), ('XXX', '.XO', '.OO'), ('OOX', '.X.', 'XXO'), ('X.O', 'XXX', 'OO.'), ('.X.', 'OX.', 'OX.'), ('XXX', 'XO.', 'O.O'), ('OOO', 'X..', 'X.X'), ('XOO', '.X.', 'XOX'), ('OOX', '.X.', 'XOX'), ('XXX', '.O.', '..O'), ('O.X', 'O.X', 'XOX'), ('XO.', 'XXX', '.OO'), ('..O', '.O.', 'XXX'), ('O..', 'OXX', 'O.X'), ('XOO', 'XXX', '..O'), ('..X', 'OXO', 'XXO'), ('OOX', 'XXX', '..O'), ('..X', 'OOX', '..X'), ('.OX', 'OX.', 'XOX'), ('XXX', 'O.O', '.OX'), ('XXO', 'XX.', 'OOO'), ('O.X', '.OX', '.XO'), ('XXX', '.OO', 'O.X'), ('XOO', 'XOX', '.OX'), ('OXO', 'XXO', 'OXX'), ('OX.', 'XOX', 'XOO'), ('XOO', 'XXO', 'X..'), ('OOX', 'XXO', 'X..'), ('OXO', 'O.X', 'OXX'), ('.XX', 'O.X', 'OOX'), ('.OX', '.OX', 'XO.'), ('.OX', 'XXX', 'O.O'), ('OOO', 'OXX', '.XX'), ('X.O', '.XO', 'X.O'), ('XOX', 'OX.', 'XO.'), ('XXO', 'OO.', 'OXX'), ('XXO', 'X.X', 'OOO'), ('..X', '..X', 'OOX'), ('XXO', '.XO', 'XOO'), ('OXX', 'OXX', 'O.O'), ('XOO', '.XO', 'XXO'), ('XO.', 'XOX', 'X.O'), ('XOX', 'OOX', 'XO.'), ('XOO', 'X..', 'XOX'), ('XO.', '.X.', 'O.X'), ('OOO', 'XXO', 'XX.'), ('OXX', 'OXO', '.X.'), ('OOO', 'X.X', 'XOX'), ('XXX', 'OOX', 'OOX'), ('XXX', 'XOO', 'OOX'), ('X..', '.XO', 'O.X'), ('X.O', 'OX.', 'XOX'), ('OXX', 'OOO', 'XX.'), ('XXX', 'OOX', 'XOO'), ('XXX', 'XOO', 'XOO'), ('XOX', 'XOX', 'OXO'), ('O.X', 'XO.', 'X.O'), ('O.O', '...', 'XXX'), ('XOX', '.OX', '.O.'), ('XXX', 'OOX', '.O.'), ('OXO', '.XO', 'XX.'), ('XXX', 'XOO', '.O.'), ('XXX', '..O', 'OXO'), ('O.X', 'OX.', 'OX.'), ('OXX', 'O..', 'O.X'), ('X.O', 'X.X', 'XOO'), ('X.O', 'XOX', 'X.O'), ('..O', 'O..', 'XXX'), ('...', 'XXX', 'O.O'), ('..X', 'OXO', 'X..'), ('OXX', '.OX', '.OX'), ('X.O', 'OXX', '.OX'), ('OXX', 'OX.', 'XO.'), ('XXX', '.OX', 'OO.'), ('.X.', '.XX', 'OOO'), ('.XX', 'OOO', 'XXO'), ('OXX', 'OXX', 'OO.'), ('.XO', 'OX.', 'OXX'), ('.XO', 'OXO', '.XX'), ('OO.', 'XXX', 'OX.'), ('XO.', 'XO.', '.OX'), ('OOX', '..X', 'XOX'), ('OOO', 'X.X', 'XXO'), ('X.O', 'X..', 'X.O'), ('X..', 'XOX', 'XOO'), ('X.O', 'OXO', 'X.X'), ('XXO', 'OOX', 'XXO'), ('OOX', 'XXO', 'XOX'), ('XXO', 'OX.', 'O.X'), ('XOO', 'XXO', 'XOX'), ('OX.', 'OXX', 'OOX'), ('OOX', 'OX.', 'OXX'), ('.XO', 'XO.', 'OX.'), ('XXX', '.OO', 'XO.'), ('.XX', 'OXO', 'OX.'), ('XXO', 'OXO', '.X.'), ('XXX', '...', 'O.O'), ('XOO', 'XO.', 'OXX'), ('.OX', 'OXO', 'XX.'), ('XXO', 'XOX', 'XOO'), ('XXX', '.OO', '.OX'), ('.OX', 'XXX', '.OO'), ('XO.', 'X..', 'X.O'), ('XX.', 'OXO', '.OX'), ('XX.', 'XOO', 'XO.'), ('X.X', '.XO', 'OOX'), ('OOX', 'X.X', '.OX'), ('OXO', '..O', 'XXX'), ('X.X', '.XO', 'XOO'), ('XXO', 'XO.', 'OOX'), ('OXO', 'XXX', 'O..'), ('XX.', '.XO', 'OXO'), ('XXX', 'O.O', '.XO'), ('.OO', 'XOX', 'XOX'), ('XO.', 'XX.', 'OOX'), ('X.X', 'OOO', '..X'), ('O.X', '.XO', 'XXO'), ('XO.', 'XX.', 'XOO'), ('.XO', 'O.O', 'XXX'), ('...', 'OO.', 'XXX'), ('OOO', 'OXX', 'XX.'), ('OX.', 'XO.', '.XO'), ('.OO', '.XO', 'XXX'), ('XXO', 'XOO', 'XOX'), ('XXO', 'OOX', 'XOX'), ('.OX', 'O.X', '..X'), ('XXX', '.OO', '...'), ('O.X', '.XO', 'XOX'), ('OO.', '.XO', 'XXX'), ('XXX', 'O.O', 'O.X'), ('OOO', 'XX.', 'OXX'), ('XO.', 'OXO', '.XX'), ('O.X', 'XOX', '..O'), ('XOO', '.X.', 'OXX'), ('XX.', 'XOO', 'X.O'), ('OXO', 'XXX', '..O'), ('OXO', '.X.', '.X.'), ('O..', 'XOX', 'X.O'), ('XX.', 'X..', 'OOO'), ('OXO', 'XXO', 'XOX'), ('OOX', 'O.X', '.XX'), ('OXX', 'OXO', 'O.X'), ('.XO', '.OO', 'XXX'), ('XXO', 'OOX', 'O.X'), ('XXO', 'XOO', 'O.X'), ('.O.', 'XXX', 'OXO'), ('XXO', 'OXO', 'X.O'), ('XOX', 'XOO', 'X..'), ('XXX', 'OOX', '..O'), ('XXX', 'XOO', '..O'), ('...', 'XXX', 'OO.'), ('XX.', 'OX.', 'OXO'), ('.XO', '.O.', 'OXX'), ('OXX', 'OXO', 'X..'), ('O.X', 'XXO', 'XO.'), ('XXX', '.OX', 'O.O'), ('OX.', 'OXO', '.XX'), ('X.O', '.XO', '..X'), ('OOO', 'XOX', 'X.X'), ('XXO', '.X.', 'OXO'), ('X.O', 'OXO', 'XXO'), ('X.O', 'X..', 'XO.'), ('XO.', 'O.O', 'XXX'), ('.XO', 'XXO', 'XOO'), ('OO.', 'OXX', 'OXX'), ('XOX', '.XO', '.OX'), ('OX.', 'OXO', 'XX.'), ('..X', 'XOX', 'OOX'), ('OXO', 'OX.', 'XX.'), ('X..', 'X..', 'XOO'), ('XO.', 'X.O', 'X..'), ('XOO', 'XXX', '.O.'), ('O.O', 'XOX', 'OXX'), ('OOX', 'XXX', '.O.'), ('OO.', 'XXX', 'O.X'), ('XXX', '.O.', '.O.'), ('..X', 'OOO', 'XX.'), ('O.X', '.O.', 'XXO'), ('XXO', 'O.O', 'XXO'), ('..O', 'XXO', 'X.O'), ('XXX', '.O.', 'OOX'), ('.O.', '.O.', 'XXX'), ('OX.', 'XXO', 'OX.'), ('.XO', '.XO', 'OXX'), ('XXX', '.O.', 'XOO'), ('OX.', 'O.X', 'O.X'), ('O.X', 'XX.', 'XOO'), ('XXX', '...', 'OO.'), ('.OX', 'XOX', 'XOO'), ('OX.', 'O..', 'OXX'), ('O.O', 'OXX', 'OXX'), ('X.O', 'XXO', 'O.X'), ('O.X', 'OXX', 'OXO'), ('X.X', 'OOO', 'XXO'), ('X..', 'OX.', 'O.X'), ('.XO', '..O', 'XXO'), ('X.O', 'XXX', '.OO'), ('.OO', 'XXX', 'X.O'), ('OOO', 'XX.', 'XXO'), ('.O.', 'OXO', 'XXX'), ('XXO', '.XO', 'O.X'), ('.OX', 'XO.', '.OX'), ('XOX', 'OOO', '.XX'), ('X.X', '..X', 'OOO'), ('OOX', '.XX', 'X.O'), ('X.X', 'OOO', '.X.'), ('O..', 'XXX', 'OOX'), ('XOO', 'XXO', '.XO'), ('O..', 'XXX', 'XOO'), ('O.X', 'OXO', 'X.X'), ('XO.', 'XXO', 'X.O'), ('XOX', 'X.O', 'XO.'), ('X.O', 'OO.', 'XXX'), ('XXX', 'O.O', '...'), ('.OX', 'OXX', 'X.O'), ('OX.', 'XO.', 'X.O'), ('XXO', 'XXO', 'OOX'), ('.XO', 'OXO', 'XX.'), ('XXX', '.OO', 'OX.'), ('XX.', 'X.O', 'XOO'), ('..X', '.X.', 'XOO'), ('OXX', 'OOO', '.XX'), ('XXX', '...', '.OO'), ('XOO', 'OX.', 'X.X'), ('OOX', 'OX.', 'X.X'), ('XOO', 'XOO', 'XXX'), ('OOX', 'XOO', 'XXX'), ('XOO', 'OOX', 'XXX'), ('O.X', 'O.X', '..X'), ('O..', 'OXX', 'OX.'), ('OOX', 'OOX', 'XXX'), ('XOX', 'X..', 'XOO'), ('.O.', '..O', 'XXX'), ('O.X', 'XOX', 'O.X'), ('.XO', 'XXX', '.OO'), ('XXO', 'X.O', '..O'), ('O.X', '..X', 'O.X'), ('O..', 'XXX', 'OXO'), ('OOO', 'XX.', 'XOX'), ('XX.', 'OOO', '..X'), ('.XX', 'X..', 'OOO'), ('OX.', '.OX', 'X.O'), ('OXX', '.XO', 'X.O'), ('XXX', 'O.O', 'XO.'), ('X.O', 'XO.', 'OX.'), ('..O', '.OX', 'OXX'), ('X.X', 'OOX', '.OX'), ('OXO', 'XOO', 'XXX'), ('OXO', 'OOX', 'XXX'), ('O.O', '.OX', 'XXX'), ('O.O', 'XXO', 'XXO'), ('XXO', '.OO', 'XXO'), ('OXX', 'OOX', '.XO'), ('OXX', 'XOO', '.XO'), ('O.X', 'OOX', '.XX'), ('XXX', '.OO', '.XO'), ('XO.', 'X.X', 'XOO'), ('.OX', 'OO.', 'XXX'), ('XXO', 'XOX', 'O.O'), ('OXO', 'XX.', 'OX.'), ('.OX', 'O.O', 'XXX'), ('.XX', 'OXO', 'X.O'), ('.OX', 'XX.', 'XOO'), ('O.X', 'O.X', 'OX.'), ('O..', 'XXX', '.O.'), ('O..', 'XOX', '.XO'), ('X.X', 'OXO', 'O.X'), ('X.O', 'OXX', 'O.X'), ('XOO', 'X.O', 'X.X'), ('OXO', 'XX.', '.XO'), ('XOX', 'OXO', 'OXX'), ('OOX', '..X', '..X'), ('XOX', 'XOO', 'XXO'), ('OOO', '.X.', 'X.X'), ('XOX', 'OOX', 'XXO'), ('XXO', 'XO.', 'O..'), ('OOO', '.XX', 'OXX'), ('OXX', '.OX', 'O.X'), ('XXO', '.XO', 'OX.'), ('XXO', '.X.', 'OOX'), ('.OO', 'XXO', 'XXO'), ('OOO', '..X', 'X.X'), ('X..', 'XO.', 'XO.'), ('.OX', 'O.X', 'OXX'), ('O.X', 'XOO', 'XXO'), ('O.X', 'OOX', 'XXO'), ('XXX', 'OO.', 'X.O'), ('O.X', 'XO.', '.XO'), ('OO.', 'O.X', 'XXX'), ('X.O', 'XO.', 'XOX'), ('XXO', 'OOO', '.XX'), ('.XO', '.XO', '.X.'), ('X.X', 'OOO', 'OXX'), ('...', 'XXX', '.OO'), ('.O.', 'XXX', '..O'), ('OXX', 'O.X', 'O..'), ('.X.', 'OOO', '.XX'), ('O.X', 'OX.', 'XXO'), ('XOX', '.O.', 'XO.'), ('O.X', 'XOX', 'XOO'), ('O..', 'OXO', 'XXX'), ('X.O', 'XXO', 'XO.'), ('O.X', 'O.O', 'XXX'), ('X.O', 'X.O', 'X..'), ('.OX', '..X', '.OX'), ('XXX', 'OO.', 'O.X'), ('.O.', '.OX', 'XOX'), ('X.O', 'OX.', '..X'), ('XOX', '.XO', 'XO.'), ('O.X', 'OXX', 'XO.'), ('OO.', 'XXX', 'XO.'), ('XO.', 'XXX', 'OO.'), ('.OX', '.XO', 'XXO'), ('OO.', 'XOX', 'XOX'), ('OOO', 'XXO', 'X.X'), ('X.O', 'XOO', 'XX.'), ('XO.', 'X.O', 'XOX'), ('XXO', '.OX', 'OOX'), ('XO.', '.XO', 'OXX'), ('OOX', 'XOX', 'OXX'), ('XOX', 'OO.', 'XOX'), ('..X', 'OOO', '.XX'), ('OX.', '.X.', '.XO'), ('XO.', 'OOX', 'XOX'), ('..X', 'OX.', 'XO.'), ('OXX', 'X.X', 'OOO'), ('OX.', 'OXX', 'O..'), ('XOX', 'OX.', 'O.X'), ('OXO', 'OXX', 'O.X'), ('OXX', '.XO', '.XO'), ('XOO', '.XO', '.XX'), ('X.X', 'OXX', 'OOO'), ('XOX', 'O.X', '.OX'), ('OOO', 'X.X', 'X..'), ('.OO', 'X.O', 'XXX'), ('X.X', 'OOX', 'O.X'), ('OXO', 'XOX', 'XOX'), ('..O', 'XXX', 'OXO'), ('OXO', 'XOX', '.XO'), ('X.X', 'OX.', 'OOX'), ('OXX', 'OXO', 'XOX'), ('..X', 'OOX', 'XOX'), ('OXO', '.XO', '.XX'), ('XOO', 'XO.', 'X.X'), ('..O', 'X.O', 'XXO'), ('X.X', 'OX.', 'XOO'), ('XOO', 'XX.', 'X.O'), ('OOX', 'XX.', 'X.O'), ('X.O', 'XOO', 'X.X'), ('XX.', 'OXX', 'OOO'), ('O.O', 'XXX', 'X.O'), ('XOO', '.OX', 'OXX'), ('.OX', '.XO', 'XOX'), ('OOO', 'XX.', '.X.'), ('OXO', 'XOX', 'O.X'), ('XO.', 'XXX', 'O.O'), ('OXO', 'XO.', 'OXX'), ('XX.', '.XO', 'OOX'), ('XO.', 'OO.', 'XXX'), ('X.X', 'OXO', '.OX'), ('OXO', 'OXO', 'XXX'), ('XOO', 'XXO', '..X'), ('XXX', 'O..', 'O..'), ('..X', 'XX.', 'OOO'), ('O..', 'OX.', 'OXX'), ('OXX', '.XO', 'OX.'), ('.O.', 'XXX', '.O.'), ('OXO', '.OX', 'OXX'), ('.XO', 'XOX', 'OOX'), ('OXO', '.O.', 'XXX'), ('XO.', '.O.', 'XOX'), ('OOO', 'X..', '.XX'), ('..X', 'O.X', '.OX'), ('..X', '.OX', 'O.X'), ('OX.', '.X.', 'OX.'), ('XOO', 'XX.', 'XO.'), ('OOX', 'XX.', 'XO.'), ('OOO', '..X', 'XX.'), ('XXX', 'X.O', 'O.O'), ('.XX', 'OOX', '.OX'), ('OXX', 'OXO', 'XXO'), ('O.O', 'XXX', 'XO.'), ('XOX', 'OXO', 'XXO'), ('XXO', 'OX.', '.XO'), ('XX.', 'OOO', 'X..'), ('X.X', 'OXO', 'X.O'), ('.X.', 'OXO', 'XXO'), ('OXO', '.XX', '.XO'), ('OXO', 'XOX', 'OX.'), ('XXO', 'OXX', 'OOX'), ('XXO', 'OXX', 'XOO'), ('X.O', 'XXO', '.OX'), ('O.X', '.OX', 'X.O'), ('O.X', 'XOX', 'OXO'), ('..X', 'X.X', 'OOO'), ('OXO', 'O..', 'XXX'), ('X.O', 'XOX', 'OOX'), ('XOX', '.XX', 'OOO'), ('XOX', 'OXO', 'XOX'), ('X..', 'XOO', 'X..'), ('XXO', 'OX.', 'OX.'), ('OX.', 'XXX', 'OO.'), ('.OX', 'X.X', 'OOX'), ('.OX', 'OOX', 'X.X'), ('XXX', 'OOX', 'OXO'), ('XXO', '.OX', 'OXO'), ('XXX', 'XOO', 'OXO'), ('XXO', '.XO', '.OX'), ('.XO', 'XO.', 'O.X'), ('..X', 'OX.', 'X.O'), ('XOO', 'XXX', 'OOX'), ('OOX', 'XXX', 'OOX'), ('XOO', 'XXX', 'XOO'), ('OOX', 'XXX', 'XOO'), ('OXX', 'O.X', '.OX'), ('X..', 'OXO', '..X'), ('OOX', '.OX', '.XX'), ('OO.', 'XXX', '.OX'), ('.XX', 'XXO', 'OOO'), ('XOO', '.O.', 'XXX'), ('OOX', '.O.', 'XXX'), ('OX.', '.O.', 'XXO'), ('X..', 'OOO', '.XX'), ('XXX', 'XO.', '.OO'), ('.XO', 'XXX', 'O.O'), ('X.O', '.XO', 'XOX'), ('XO.', 'XOX', '.O.'), ('.OX', 'O.X', 'XOX'), ('.XX', 'OOO', 'OXX'), ('.O.', 'XOO', 'XXX'), ('O.X', 'XOX', '.OX'), ('.O.', 'OOX', 'XXX'), ('XOO', 'XOX', 'XXO'), ('OXX', 'XOX', '.OO'), ('O.O', 'O.X', 'XXX'), ('OO.', 'XXX', 'X.O'), ('OX.', 'XOX', 'OXO'), ('OOX', 'XOX', 'XO.'), ('X..', 'OOO', 'XX.'), ('..X', 'XXO', 'XOO'), ('OXX', '.OX', 'XOO'), ('XO.', 'XOO', 'X.X'), ('.XO', 'OX.', '.X.'), ('O.X', 'XXX', 'O.O'), ('O..', 'O.X', 'OXX'), ('XO.', '.OX', '.OX'), ('OO.', 'OX.', 'XXX'), ('XOX', '.XO', 'X.O'), ('OX.', 'XOO', 'XXO'), ('.OO', 'XXX', 'O.X'), ('OXX', 'OOX', '..X'), ('..X', 'OXX', 'OOX'), ('.OO', 'O.X', 'XXX'), ('OX.', 'OOX', 'XXO'), ('OOX', 'XO.', 'XXO'), ('OXO', '.XX', 'OX.'), ('..X', 'OXX', 'XOO'), ('OOX', 'X.X', 'O.X'), ('X.O', 'OXO', '.XX'), ('XXO', '.O.', 'O.X'), ('O..', '..O', 'XXX'), ('..X', '.OX', '.OX'), ('..X', 'O.X', 'O.X'), ('..O', 'XXX', 'O..'), ('.XO', 'OX.', 'XXO'), ('XX.', 'XXO', 'OOO'), ('OOX', 'XO.', 'XOX'), ('.XX', 'OOX', 'O.X'), ('XXX', 'OXO', '.O.'), ('OXO', 'XXO', '.X.'), ('.XX', 'OX.', 'XOO'), ('.XX', '.X.', 'OOO'), ('XOO', 'OXX', 'OXX'), ('OXO', 'XXX', 'OXO'), ('OXX', '.X.', 'OXO'), ('O..', 'O..', 'XXX'), ('XOX', 'OXX', 'XOO'), ('X..', 'X.O', 'XO.'), ('XOX', 'OXX', 'OOX'), ('.XO', '.X.', '.XO'), ('OXX', 'XOO', 'XOX'), ('OXX', 'OOX', 'XOX'), ('XOO', '.XX', '.OX'), ('OOX', '.XX', '.OX'), ('OX.', '.XO', '.X.'), ('..X', 'OXO', 'XOX'), ('XOO', '.OX', 'XOX'), ('XOX', '.X.', 'OOX'), ('XOX', '.X.', 'XOO'), ('X.X', 'XOO', 'X.O'), ('..O', 'XXX', '..O'), ('O.X', '.X.', 'XO.'), ('.OX', 'OXX', '.OX'), ('.XX', 'OOO', '..X'), ('XO.', 'XO.', 'XXO'), ('.OX', '.O.', 'XOX'), ('XOO', 'X.O', 'XX.'), ('.OO', 'XOX', 'OXX'), ('XXX', 'O..', 'OXO'), ('XO.', 'XXO', '.OX'), ('XXX', 'X.O', '.OO'), ('.OX', 'XXO', 'XO.'), ('OXX', '.XO', 'XO.'), ('OXO', 'XO.', 'XXO'), ('XO.', 'OXO', 'X.X'), ('.O.', 'XXX', 'O..'), ('X.O', 'X.O', '.XO'), ('XO.', 'OXX', 'O.X'), ('XXX', 'OO.', '.OX'), ('.OX', '..X', 'O.X'), ('XOX', 'X.O', 'X.O'), ('OOO', 'X.X', '..X'), ('XO.', 'XXO', 'XO.'), ('XOO', 'X..', 'X..'), ('OXO', '.OX', 'XXO'), ('XXX', 'O..', '.O.'), ('..X', '.XX', 'OOO'), ('XXX', 'OX.', 'OO.'), ('XXX', 'O.X', '.OO'), ('.OX', 'OXX', 'XO.'), ('.XO', 'X.O', '.XO'), ('XX.', 'XOX', 'OOO'), ('.XO', '.X.', 'OX.'), ('OOX', '.XX', 'XO.'), ('OX.', '.XX', 'OXO'), ('XXO', 'XO.', 'XO.'), ('OOO', 'XOX', '.XX'), ('.XO', 'XOO', 'OXX'), ('.XO', 'OOX', 'OXX'), ('.OX', '.XX', 'OOX'), ('OXX', 'OOX', 'OX.'), ('XXO', '.O.', 'OX.'), ('.OX', '.XX', 'XOO'), ('X.O', '.X.', 'O.X'), ('OXX', 'XO.', 'XOO'), ('.OO', 'XXX', 'XO.'), ('OX.', 'OOX', 'OXX'), ('OXO', 'XXO', 'X.O'), ('O..', 'XXX', '..O'), ('X..', 'XOO', 'XXO'), ('XOX', 'XOX', 'OO.'), ('OOX', 'XXO', 'XXO'), ('OXX', 'OX.', 'OOX'), ('.OX', '.X.', 'XO.'), ('OX.', 'OX.', 'XXO'), ('XXX', 'OOX', 'O..'), ('.OX', 'OXO', 'X.X'), ('XXX', 'OXO', 'OXO'), ('X.O', '.XO', 'OXX'), ('.OO', '.OX', 'XXX'), ('O.X', 'XXX', 'OO.'), ('OXX', 'XXO', 'OOX'), ('OXX', 'XXO', 'XOO'), ('X.X', 'XXO', 'OOO'), ('XXX', 'XOO', 'O..'), ('X..', 'XOO', 'XOX'), ('.XX', 'OOO', 'XOX'), ('.X.', 'OOO', 'XX.'), ('.X.', 'OXX', 'OXO'), ('OX.', 'O.X', 'OX.'), ('..O', 'XOX', 'OX.'), ('..X', '.XO', 'X.O'), ('OXO', 'XXX', 'OOX'), ('XXO', 'OOO', 'XX.'), ('.X.', 'OXO', 'OXX'), ('OXO', 'XXX', 'XOO'), ('OXX', '.X.', 'XOO'), ('XX.', 'OX.', 'OOX'), ('OXO', 'XXX', '.O.'), ('O.X', 'OXX', 'O..'), ('OXX', 'OO.', 'XXO'), ('XOX', 'OXX', 'OXO'), ('OOO', '.X.', 'XX.'), ('XXO', 'OXO', '..X'), ('XOO', 'O..', 'XXX'), ('OOX', 'O..', 'XXX'), ('.X.', 'X.X', 'OOO'), ('.XX', 'OX.', 'OXO'), ('OO.', 'XO.', 'XXX'), ('OOO', 'XOX', 'XX.'), ('.OO', 'XXX', '...'), ('.OX', 'XOX', 'O.X'), ('.XO', '.XX', 'OXO'), ('.OX', 'XO.', 'XO.'), ('OXX', '.OX', 'OXO'), ('..O', 'XOO', 'XXX'), ('..O', 'OOX', 'XXX'), ('XOX', 'O.X', 'O.X'), ('X.O', 'XX.', 'OOX'), ('X.O', 'XX.', 'XOO'), ('O.O', 'X.O', 'XXX'), ('O..', '.O.', 'XXX'), ('O.X', 'OXO', 'XX.'), ('OXX', 'O.O', 'OXX'), ('XOO', 'X..', 'XXO'), ('XOX', 'OOO', 'X.X'), ('XO.', '.OX', 'XO.'), ('XOO', 'X.X', 'X.O'), ('.XX', '..X', 'OOO'), ('O.O', 'XOX', 'XXO'), ('O.X', 'XXO', 'X.O'), ('X..', '.X.', 'OOX'), ('O.O', 'XXX', '...'), ('XX.', 'OOO', 'OXX'), ('X.O', '.OX', 'OX.'), ('OXX', 'OOO', 'X.X'), ('OXX', 'XO.', '..O'), ('XOO', 'OX.', '.XX'), ('OX.', 'XXO', '.XO'), ('O..', 'XXX', 'O..'), ('.OX', 'OXX', 'O.X'), ('XXO', '..O', 'X.O'), ('XXX', 'OX.', 'O.O'), ('XO.', 'XXO', 'O.X'), ('O.X', 'OO.', 'XXX'), ('X.O', 'XXO', '..O'), ('OXX', 'XOO', 'OXX'), ('XOX', 'XX.', 'OOO'), ('.OX', '.OX', '..X'), ('XXX', 'O.O', 'OX.'), ('X.O', '.X.', '.OX'), ('XXO', 'XOO', '.XO'), ('X.X', 'X..', 'OOO'), ('XO.', 'OXX', '.OX'), ('OX.', 'XX.', 'OXO'), ('XXO', 'XXO', 'O.O'), ('O.O', 'XXX', '.OX'), ('OX.', '.XO', 'XXO'), ('O.X', 'X.X', 'OOX'), ('.OO', '...', 'XXX'), ('OOO', '.XX', '..X'), ('XXX', 'O.X', 'O.O'), ('XOO', 'XX.', '.OX'), ('.XX', 'OXO', '.XO'), ('O..', 'XOO', 'XXX'), ('O..', 'OOX', 'XXX'), ('OXX', 'OO.', 'OXX'), ('O..', 'XO.', 'XXO'), ('.OX', '.XO', 'X..'), ('X.O', '.OX', 'O.X'), ('XXX', '.OO', 'X.O'), ('OOO', 'OXX', 'X.X'), ('XO.', '.XO', '..X'), ('XOO', 'X.X', 'XO.'), ('XXO', 'OXX', 'OXO'), ('XXO', '.XX', 'OOO'), ('O.X', 'XXX', '.OO'), ('OX.', '.OX', '.XO'), ('XX.', '.X.', 'OOO'), ('O.X', '.OX', 'OXX'), ('OOO', '.X.', '.XX'), ('..O', '.XO', 'XXO'), ('XO.', 'X..', 'XO.'), ('X.O', 'OX.', 'OXX'), ('OXX', '.O.', 'X.O'), ('.X.', 'OXO', '.X.'), ('XXX', 'OXO', 'O..'), ('XOO', 'XOX', 'X..'), ('XOO', '.X.', '..X'), ('.XO', 'XOX', 'OXO'), ('OOO', '.XX', 'XOX'), ('OX.', 'OXX', '.XO'), ('XX.', 'OOO', '.X.'), ('.OO', 'XXX', '.OX'), ('XXX', 'O..', '..O'), ('OX.', '.OO', 'XXX'), ('XOX', 'XOO', '.OX'), ('X.X', 'OOO', 'XOX'), ('OXO', 'OXX', '.X.'), ('XXO', 'OOO', 'X.X'), ('XXO', '.OO', 'OXX'), ('XOO', 'XOX', 'OX.'), ('.OX', '.OX', 'OXX'), ('XX.', 'XO.', 'XOO'), ('OXX', 'XOX', 'O.O'), ('XXX', 'O.X', 'OO.'), ('X.O', '.XX', 'OOX'), ('XX.', 'OOO', 'XXO'), ('X.X', '.OX', 'OOX'), ('.X.', 'OOO', 'X.X'), ('XXX', 'OO.', 'OX.'), ('OX.', 'O.O', 'XXX'), ('XXX', '..O', 'O..'), ('O.X', 'OX.', 'O.X'), ('OXX', 'OX.', 'X.O'), ('OOX', 'OXX', 'X..'), ('..O', 'XXX', '.O.'), ('..O', 'XXX', 'OOX'), ('..O', 'XXX', 'XOO'), ('.OO', 'XXX', '.XO'), ('OOX', '..X', 'OXX'), ('XOX', 'OXO', '..X'), ('XOX', 'OOO', 'XX.'), ('XXO', 'XO.', 'X.O'), ('X.O', 'XO.', 'X..'), ('OOO', 'XX.', 'X..'), ('.XO', 'XOO', 'XXO'), ('XXX', '.O.', 'O..'), ('OOO', '.XX', 'XXO'), ('OXX', '.XX', 'OOO'), ('XO.', '.XO', 'XOX'), ('X.O', 'XOX', 'XO.'), ('XOO', 'XXO', 'OXX'), ('OOX', 'XXO', 'OXX'), ('..X', '.XO', 'XO.'), ('X.X', 'OOO', 'X..'), ('XOO', '.XO', 'X.X'), ('OOX', '.XO', 'X.X'), ('XOX', 'OXO', 'X..'), ('.OX', '.X.', 'X.O'), ('XOX', 'OX.', 'X.O'), ('OO.', 'XXX', '.XO'), ('XX.', 'OXO', 'OX.'), ('XOX', 'OOX', '..X'), ('OOO', '.XX', 'X..'), ('OXX', 'OX.', '.XO'), ('.XO', 'XXO', 'OX.'), ('XOO', 'OXX', '..X'), ('OOX', 'OXX', '..X'), ('XX.', 'OOO', 'XOX'), ('O.X', 'OXX', '.OX'), ('.XX', '.XO', 'OXO'), ('OOO', '.XX', '.X.'), ('XOX', 'XO.', '.O.'), ('XXX', 'OO.', '...'), ('OOO', 'X..', 'XX.'), ('OX.', 'OX.', 'O.X'), ('..O', 'XO.', 'OXX'), ('XOX', '.O.', '.OX'), ('OX.', 'XOX', '..O'), ('XXX', '.OX', '.OO'), ('O.O', 'XXX', '.XO'), ('.XO', '.OX', 'O.X'), ('OOX', 'OXO', 'XXX'), ('XOO', 'OXO', 'XXX'), ('.XX', '.XO', 'XOO'), ('O.X', '.X.', 'X.O'), ('OXX', '..X', 'OOX'), ('O.X', 'OX.', 'X..'), ('X.O', '.OO', 'XXX'), ('OX.', '.XO', 'OXX'), ('XXO', 'OX.', '.OX'), ('X.O', 'X.O', 'XOX'), ('XOX', '.OX', 'XOO'), ('OXO', 'XOX', 'X.O'), ('OXX', '.O.', '.XO'), ('OOX', 'XOX', '..X'), ('X.O', 'XO.', 'O.X'), ('O.O', 'XXX', 'O.X'), ('O.X', 'O..', 'OXX'), ('XOX', '.OX', 'O.X'), ('X.O', 'XO.', 'XXO'), ('OXX', 'XXO', 'OXO'), ('X..', 'XX.', 'OOO'), ('.X.', '.X.', 'OXO'), ('O.O', 'XXX', 'OX.'), ('XOO', 'XX.', 'O.X'), ('XO.', '.OO', 'XXX'), ('.X.', 'XXO', 'OXO'), ('O.X', 'OX.', 'XOX'), ('XOX', 'XOX', '.OO'), ('O.X', '.XX', 'OOX'), ('O.X', '.XX', 'XOO'), ('XO.', 'OX.', 'XOX'), ('OOX', 'O.X', 'X.X'), ('.XO', 'XXO', '..O'), ('.XO', '.OX', 'OX.'), ('.OX', 'XXO', 'X.O'), ('OO.', 'XOX', 'XXO'), ('XX.', 'OXO', '.XO'), ('XXX', '.XO', 'O.O'), ('XXO', '.OX', 'O..'), ('XOX', 'X.X', 'OOO'), ('X.O', '..O', 'XXO'), ('.OX', 'OOX', '.XX'), ('X.X', 'XOO', 'XO.'), ('XX.', 'OXO', 'O.X'), ('X..', 'X.O', 'X.O'), ('OOX', '.OX', 'X.X'), ('XOO', 'XXX', 'OXO'), ('OOX', 'XXX', 'OXO'), ('OO.', '.OX', 'XXX'), ('O.X', '.OX', 'XOX'), ('.OO', 'XXX', 'OX.'), ('..O', 'OXO', 'XXX'), ('XOX', 'XXO', 'OOX'), ('OO.', '...', 'XXX'), ('OXO', '.X.', 'XXO'), ('OOX', 'XOX', 'X.O'), ('XXO', 'OXO', 'XOX'), ('XOX', 'XXO', 'XOO'), ('X..', 'OXX', 'OOX'), ('XXX', 'X.O', 'OO.'), ('XXO', 'X.O', 'XO.'), ('X..', 'OOO', 'X.X'), ('.XO', 'XOX', 'O..'), ('XXX', 'OX.', '.OO'), ('X..', '.XX', 'OOO'), ('.XX', '.OX', 'OOX'), ('XOX', '..X', 'OOX'), ('X..', 'XXO', 'OOX'), ('X..', 'XXO', 'XOO'), ('O.O', 'OX.', 'XXX'), ('XO.', 'OX.', '..X'), ('OXO', 'OX.', '.XX'), ('X.O', '.XO', '.XO'), ('O.X', '.XO', 'X..'), ('O.X', '.OX', '..X'), ('XXO', 'XOO', 'X..'), ('XOO', 'XOX', 'O.X'), ('X..', 'OXO', 'XOX'), ('..O', '..O', 'XXX'), ('OXX', 'OX.', 'O..'), ('O.O', 'XO.', 'XXX'), ('.XO', 'X.O', 'X.O'), ('OXX', 'OOX', 'X.O'), ('OXX', 'XOO', 'X.O'), ('X.O', 'XOX', 'OXO'), ('XOX', 'XO.', 'X.O'), ('.O.', 'XOX', '.OX'), ('XOO', '.XX', 'O.X'), ('OOX', '.XX', 'O.X'), ('XXX', '.O.', 'OXO'), ('.XX', 'OOO', 'X..'), ('X.X', 'OXO', 'XO.'), ('OXX', 'XOX', 'OOX'), ('...', '.OO', 'XXX'), ('XXX', 'OXO', '..O'), ('.XX', 'OOO', '.X.'), ('XO.', '.X.', '.OX'), ('.X.', '.XO', '.XO'), ('XXO', 'XOX', 'OO.'), ('X..', '.XO', '.OX'), ('X.O', 'O.O', 'XXX'), ('OOO', 'X.X', '.X.'), ('OO.', 'XXX', '...'), ('X.X', '.X.', 'OOO'), ('XXO', '.XO', '..O'), ('.OO', 'OX.', 'XXX'), ('XXX', 'OO.', '.XO'), ('X.X', 'XO.', 'XOO'), ('XXX', '.XO', 'OO.'), ('.OX', 'XOO', 'XOX'), ('.OX', '.OO', 'XXX'), ('XOO', 'OXX', 'XOX'), ('OOX', 'OXX', 'XOX'), ('OOX', 'XOX', '.XO'), ('XXO', 'OOX', 'OX.'), ('XXO', 'XOO', 'OX.'), ('.XX', 'XOX', 'OOO'), ('.X.', 'XX.', 'OOO'), ('OXX', '.OX', '..O'), ('OXO', '.X.', 'OXX'), ('OXX', 'OXX', 'XOO'), ('XO.', 'X.O', 'XXO'), ('X.X', 'X.O', 'XOO'), ('.O.', 'XXX', 'OOX'), ('XO.', 'OX.', 'OXX'), ('.O.', 'O..', 'XXX'), ('.O.', 'XXX', 'XOO'), ('XO.', '.XX', 'OOX'), ('X..', 'OX.', '.OX'), ('OX.', 'OX.', '.X.'), ('O.X', 'OOX', 'X.X'), ('OX.', 'OO.', 'XXX'), ('XXX', '..O', '..O'), ('OOO', 'XX.', '..X'), ('.XO', 'OXX', 'OX.'), ('XO.', 'XOO', 'XX.'), ('O.X', '..X', '.OX'), ('XOX', '.OO', 'XOX'), ('OXO', 'OXX', 'XXO'), ('XOO', 'OXX', 'XXO'), ('OOX', 'OXX', 'XXO'), ('X.X', 'O.X', 'OOX'), ('XXX', 'XO.', 'OO.'), ('OOX', 'OX.', 'XX.'), ('.XO', 'OXX', '.XO'), ('O.X', '.OO', 'XXX'), ('..O', 'XXO', '.XO'), ('OOX', 'OXX', 'OX.'), ('XXO', 'XO.', 'OXO'), ('XXX', 'OXO', 'OOX'), ('XXX', 'OXO', 'XOO'), ('OOO', 'X.X', 'OXX'), ('XOO', 'XO.', 'XX.'), ('XOO', 'XXX', 'O..'), ('OOX', 'XXX', 'O..'), ('XXO', 'OXO', 'OXX'), ('OO.', 'X.O', 'XXX'), ('XOX', 'XXO', 'OXO'), ('XX.', '..X', 'OOO'), ('OOO', '..X', '.XX'), ('XXO', 'X.O', 'OXO'), ('.XO', 'XX.', 'OXO'), ('OX.', 'XXX', '.OO'), ('XOX', 'XOO', 'OXX'), ('XOX', 'OOX', 'OXX'), ('XXX', '..O', '.O.'), ('OXO', 'OXX', 'XOX'), ('X..', 'X.X', 'OOO'), ('.OX', 'OX.', 'X..'), ('XO.', 'XOX', 'OOX'), ('X.O', 'XXO', 'OXO'), ('X.O', '.O.', 'OXX')}
	while True:
		s = input()
		if s == 'end':
			break
		print('valid' if tuple([s[:3], s[3:6], s[6:9]]) in his else 'invalid')
import collections

def kingpath():

	def adds(x, y, c):
		s = (x, y)
		if s in sgs and s not in his:
			todo.append([x, y, c + 1])
			his.add(s)
	(startx, starty, endx, endy) = map(int, input().split())
	seg = int(input())
	sgs = set()
	for i in range(seg):
		(row, s, e) = map(int, input().split())
		for i1 in range(s, e + 1):
			sgs.add((row, i1))
	todo = collections.deque([[startx, starty, 0]])
	his = set()
	while todo:
		(x, y, step) = todo.popleft()
		if x == endx and y == endy:
			return step
		adds(x - 1, y, step)
		adds(x + 1, y, step)
		adds(x, y - 1, step)
		adds(x, y + 1, step)
		adds(x - 1, y - 1, step)
		adds(x + 1, y + 1, step)
		adds(x - 1, y + 1, step)
		adds(x + 1, y - 1, step)
	return -1

def postin():
	buildings = int(input())
	l = []
	c = 0
	for _ in range(buildings):
		(d, h) = map(int, input().split())
		while l and l[-1] > h:
			l.pop()
		if l and l[-1] != h or not l:
			c += 1
			l.append(h)
	return c
import collections

def q1():
	for _ in range(int(input())):
		num = int(input())
		c = sorted(list(collections.Counter(input().split()).items()), key=lambda x: int(x[0]))
		ans = []
		for i in range(len(c)):
			ans.append(c[i][0])
			c[i] = [c[i][0]] + [c[i][1] - 1]
		for i in c:
			if i[1]:
				ans += i[1] * [i[0]]
		print(*ans, sep=' ')

def q2():
	for _ in range(int(input())):
		(num, m) = map(int, input().split())
		(now, *l) = input().split()
		c = 1
		num -= 1
		while l:
			now = int(now)
			for i in range(num):
				if not (now + int(l[i])) % m:
					now = l.pop(i)
					break
			else:
				c += 1
				(now, *l) = l
			num -= 1
		print(c)

def q2re():
	for _ in range(int(input())):
		counter = collections.defaultdict(int)
		(num, m) = map(int, input().split())
		ans = 0
		for i in input().split():
			counter[int(i) % m] += 1
		if counter[0]:
			ans += 1
		his = set()
		for i in list(counter.keys()):
			if i and i not in his:
				his.add(m - i)
				ans += 1
				ans += max(0, abs(counter[i] - counter[m - i]) - 1)
		print(ans)

def c1(num):
	if num % 2:
		return [1, num // 2, num // 2]
	else:
		half = num // 2
		if half % 2:
			return [2, half - 1, half - 1]
		else:
			return [half // 2, half // 2, half]

def c1call():
	for _ in range(int(input())):
		print(*c1(int(input().split()[0])), sep=' ')

def c2call():
	for _ in range(int(input())):
		(num, k) = map(int, input().split())
		print(*[1] * (k - 3), *c1(num - (k - 3)), sep=' ')

def dominos():
	for _ in range(int(input())):
		(n, k, k1) = map(int, input().split())
		(w, b) = map(int, input().split())
		if k1 > k:
			r = k1 - k
			w -= k
			w -= r // 2
			br = n - k - (n - k1)
			b -= n - k1
			b -= br // 2
		elif k1 < k:
			r = k - k1
			w -= k1
			w -= r // 2
			br = n - k1 - (n - k)
			b -= n - k
			b -= br // 2
		else:
			w -= k1
			b -= n - k
		print('yes' if b <= 0 and w <= 0 else 'no')
dominos()


t = int(input())
for _ in range(t):
	(n, k1, k2) = list(map(int, input().split()))
	(w, b) = list(map(int, input().split()))
	poss = True
	if k1 + k2 < 2 * w:
		poss = False
	if 2 * n - k1 - k2 < 2 * b:
		poss = False
	if poss:
		print('YES')
	else:
		print('NO')


import math
import sys
input = sys.stdin.readline
t = int(input())
for i1 in range(t):
	(n, k1, k2) = map(int, input().split())
	(w, b) = map(int, input().split())
	if 2 * w > k1 + k2 or 2 * b > 2 * n - k1 - k2:
		print('NO')
	else:
		print('YES')


for _ in range(int(input())):
	(n, k1, k2) = map(int, input().split())
	(w, b) = map(int, input().split())
	min_white = min(k1, k2)
	max_white = max(k1, k2)
	whites = min_white + (max_white - min_white) // 2
	max_black = n - max_white
	min_black = (n - max_black - min_white) // 2
	blacks = min_black + max_black
	if whites + blacks < w + b or whites < w or blacks < b:
		print('NO')
	else:
		print('YES')


t = int(input())
for i in range(t):
	(n, k1, k2) = map(int, input().split())
	(w, b) = map(int, input().split())
	white = 2 * w
	black = 2 * b
	r = k1 + k2
	print('YES' if white <= r and black <= 2 * n - r else 'NO')


import sys
import math
from collections import Counter, defaultdict
LI = lambda : list(map(int, input().split()))
MAP = lambda : map(int, input().split())
IN = lambda : int(input())
S = lambda : input()

def case():
	(n, a, b) = MAP()
	(p, q) = MAP()
	w = 2 * min(a, b) + abs(b - a)
	bl = 2 * n - w
	if w >= 2 * p and 2 * q <= bl:
		print('YES')
	else:
		print('NO')
for _ in range(IN()):
	case()


import sys
input = sys.stdin.readline
ins = lambda : input().rstrip()
ini = lambda : int(input().rstrip())
inm = lambda : map(int, input().rstrip().split())
inl = lambda : list(map(int, input().split()))
out = lambda x, s='\n': print(s.join(map(str, x)))
t = ini()
for _ in range(t):
	(n, k1, k2) = inm()
	(w, b) = inm()
	x = k1 + k2
	if x >= w * 2 and n * 2 - x >= b * 2:
		print('YES')
	else:
		print('NO')


p = lambda : list(map(int, input().split()))
T = p()[0]
for _ in range(T):
	(N, K1, K2) = p()
	(W, B) = p()
	if K1 + K2 < 2 * W:
		print('NO')
	elif 2 * N - K1 - K2 < 2 * B:
		print('NO')
	else:
		print('YES')


for _ in range(int(input())):
	(n, k0, k1) = map(int, input().split())
	(a, b) = map(int, input().split())
	a1 = min(k0, k1) + abs(k0 - k1) // 2
	b1 = n - max(k0, k1) + abs(k0 - k1) // 2
	if a <= a1 and b <= b1:
		print('YES')
	else:
		print('NO')


answers = []

def solve(n, k1, k2, w, b):
	white = min(k1, k2)
	diff = abs(k2 - k1)
	white += diff // 2
	black = min(n - k1, n - k2)
	diff = abs(k2 - k1)
	black += diff // 2
	if w <= white and b <= black:
		answers.append('YES')
		return
	answers.append('NO')
T = int(input())
while T:
	(n, k1, k2) = [int(x) for x in input().split()]
	(w, b) = [int(x) for x in input().split()]
	solve(n, k1, k2, w, b)
	T -= 1
for ans in answers:
	print(ans)


for q in range(int(input())):
	(n, k1, k2) = map(int, input().split())
	(w, b) = map(int, input().split())
	t = k1 + k2
	t1 = 2 * n - t
	if 2 * w <= t and 2 * b <= t1:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	(n, k1, k2) = map(int, input().split())
	(w, b) = map(int, input().split())
	p = k1 + k2
	m = 2 * n
	q = m - p
	if p >= 2 * w and q >= 2 * b:
		print('YES')
	else:
		print('NO')


from math import ceil, floor, log
import sys, threading
from heapq import heappush, heappop
from collections import Counter, defaultdict, deque
import bisect
input = lambda : sys.stdin.readline().strip()
c = lambda x: 10 ** 9 if x == '?' else int(x)

def rec(a, l, r, m, i, l1):
	if l == r:
		l1[l] = i
		return
	if l > r:
		return
	l1[max(m[l:r + 1], key=lambda x: a[x])] = i
	rec(a, l, max(m[l:r + 1], key=lambda x: a[x]) - 1, m, i + 1, l1)
	rec(a, max(m[l:r + 1], key=lambda x: a[x]) + 1, r, m, i + 1, l1)

class node:

	def __init__(self, x, y):
		self.a = [x, y]

	def __lt__(self, b):
		return b.a[0] < self.a[0]

	def __repr__(self):
		return str(self.a[0]) + ' ' + str(self.a[1])

def main():
	prime = [1] * 10 ** 5
	p = []
	for i in range(2, 10 ** 5):
		if prime[i]:
			for j in range(i * i, 10 ** 5, i):
				prime[j] = 0
			p.append(i)
	for _ in range(int(input())):
		(n, k1, k2) = list(map(int, input().split()))
		(w, b) = list(map(int, input().split()))
		w1 = min(k1, k2)
		b1 = n - max(k1, k2)
		w2 = (max(k1, k2) - min(k1, k2)) // 2
		if w <= w1 + w2 and b <= b1 + w2:
			print('YES')
		else:
			print('NO')
main()


for i in range(int(input())):
	(n, k1, k2) = list(map(int, input().split()))
	w = (k1 + k2) // 2
	b = (n * 2 - k1 - k2) // 2
	(wd, bd) = list(map(int, input().split()))
	if w >= wd and b >= bd:
		print('YES')
	else:
		print('NO')


t = int(input())
while t > 0:
	(n, k1, k2) = [int(i) for i in input().split()]
	(w, b) = [int(i) for i in input().split()]
	x = min(k1, k2)
	let = k1 - x + (k2 - x)
	ok = let // 2
	if ok + x < w:
		print('No')
		t -= 1
		continue
	else:
		x = min(n - k1, n - k2)
		ok = let // 2
		if x + ok < b:
			print('No')
			t -= 1
			continue
	print('Yes')
	t -= 1


for _ in range(int(input())):
	(n, k1, k2) = map(int, input().split())
	vw = min(k1, k2)
	vb = n - max(k1, k2)
	(w, b) = map(int, input().split())
	hw = k1 - vw + (k2 - vw)
	hb = n - k1 + (n - k2) - 2 * vb
	if vw + hw // 2 >= w and vb + hb // 2 >= b:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	(n, k1, k2) = list(map(int, input().split()))
	(w, b) = list(map(int, input().split()))
	black = 2 * n - k1 - k2
	white = k1 + k2
	c = False
	d = False
	if white - 2 * w >= 0:
		c = True
	if black - 2 * b >= 0:
		d = True
	if c and d:
		print('Yes')
	else:
		print('No')


tests = int(input())
for t in range(0, tests):
	(n, k1, k2) = map(int, input().split())
	(w, b) = map(int, input().split())
	totalspaces = 2 * n
	bspaces = totalspaces - k1 - k2
	wspaces = k1 + k2
	if w * 2 <= wspaces and b * 2 <= bspaces:
		print('YES')
	else:
		print('NO')


import sys

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

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

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

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

def get_int():
	return int(sys.stdin.readline().strip())

def get_print_int(x):
	sys.stdout.write(str(x) + '\n')

def get_print(x):
	sys.stdout.write(x + '\n')

def get_print_int_same(x):
	sys.stdout.write(str(x) + ' ')

def get_print_same(x):
	sys.stdout.write(x + ' ')
from sys import maxsize

def solve():
	for _ in range(get_int()):
		(n, k1, k2) = get_ints()
		(w, b) = get_ints()
		if k1 == k2:
			if w <= k1 and b <= n - k1:
				get_print('YES')
			else:
				get_print('NO')
		elif k1 > k2:
			diff = k1 - k2
			req1 = k2 + diff // 2
			req2 = n - k1 + diff // 2
			if req1 >= w and req2 >= b:
				get_print('YES')
			else:
				get_print('NO')
		else:
			diff = k2 - k1
			req1 = k1 + diff // 2
			req2 = n - k2 + diff // 2
			if req1 >= w and req2 >= b:
				get_print('YES')
			else:
				get_print('NO')
solve()


def place_dominoes(n: int, k1: int, k2: int, w: int, b: int) -> bool:
	diff = abs(k1 - k2)
	whites = min(k1, k2) + diff // 2
	blacks = min(n - k1, n - k2) + diff // 2
	if w > whites:
		return False
	if b > blacks:
		return False
	return True
for _ in range(int(input())):
	(n, k1, k2) = map(int, input().split())
	(w, b) = map(int, input().split())
	print('YES' if place_dominoes(n, k1, k2, w, b) else 'NO')


n = int(input())
mas = []
for i in range(n):
	(n, k1, k2) = map(int, input().split())
	(w, b) = map(int, input().split())
	if w == 0 and b == 0:
		a = 'yes'
	else:
		bel = k1 + k2
		ch = n * 2 - bel
		if w * 2 <= bel and b * 2 <= ch:
			a = 'yes'
		else:
			a = 'no'
	mas.append(a)
for i in mas:
	print(i)


list1 = []
for i in range(int(input())):
	(n, k1, k2) = [int(j) for j in input().split()]
	(w, b) = [int(j) for j in input().split()]
	if min(k1, k2) + abs(k2 - k1) // 2 >= w and min(n - k1, n - k2) + abs(k2 - k1) // 2 >= b:
		list1.append('YES')
	else:
		list1.append('NO')
print(*list1, sep='\n')


def zip_sorted(a, b):
	(a, b) = zip(*sorted(zip(a, b)))
	sorted(zip(a, b), key=lambda x: x[1])
	return (a, b)

def number_to_list(a):
	b = []
	while a >= 1:
		c = a % 10
		a = int(a / 10)
		b.append(c)
	return list(reversed(b))

def str_list_to_int_list(a):
	a = list(map(int, a))
	return a

def make_1d_array(n, inti=0):
	a = [inti for _ in range(n)]
	return a

def make_2d_array(n, m, inti=0):
	a = [[inti for _ in range(m)] for _ in range(n)]
	return a

def make_3d_array(n, m, k, inti=0):
	a = [[[inti for _ in range(k)] for _ in range(m)] for _ in range(n)]
	return a

def gcd(a, b):
	if b == 0:
		return a
	else:
		return gcd(b, a % b)
import sys
input = sys.stdin.readline
I = lambda : list(map(int, input().split()))
S = lambda : list(map(str, input()))
(t,) = I()
for t1 in range(t):
	(n, k1, k2) = I()
	(w, b) = I()
	w1 = min(k1, k2) + (max(k1, k2) - min(k1, k2)) // 2
	b1 = n - max(k1, k2) + (max(k1, k2) - min(k1, k2)) // 2
	if w > w1:
		print('NO')
	elif b > b1:
		print('NO')
	else:
		print('YES')


from __future__ import division, print_function
import os
import sys
sys.setrecursionlimit(1000000)
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():
	pass
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')
import math
import sys
import bisect
from collections import defaultdict
for t in range(int(input())):
	(n, k1, k2) = map(int, input().split())
	(w, b) = map(int, input().split())
	if w <= (k1 + k2) // 2 and b <= (2 * n - k1 - k2) // 2:
		print('YES')
	else:
		print('NO')
main()


num = int(input())
for i in range(num):
	(n, k1, k2) = [int(x) for x in input().split()]
	(w, b) = [int(x) for x in input().split()]
	(black1, black2) = (n - k1, n - k2)
	if (black1 + black2) // 2 >= b and (k1 + k2) // 2 >= w:
		print('YES')
	else:
		print('NO')


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	(n, k1, k2) = map(int, input().split())
	(w, b) = map(int, input().split())
	if w > (k1 + k2) / 2 or b > (2 * n - k1 - k2) / 2:
		print('NO')
		continue
	elif w < (k1 + k2) / 2 and b < (2 * n - k1 - k2) / 2:
		print('YES')
		continue
	elif w == (k1 + k2) / 2 and b == (2 * n - k1 - k2) / 2:
		if k1 % 2 == k2 % 2 and (n - k1) % 2 == (n - k2) % 2:
			print('YES')
			continue
	elif w < (k1 + k2) / 2:
		if k1 % 2 == k2 % 2:
			print('YES')
			continue
	elif b < (2 * n - k1 - k2) / 2:
		if (n - k1) % 2 == (n - k2) % 2:
			print('YES')
			continue
	else:
		print('NO')


import math
from collections import defaultdict
DEBUG = True

def log(*args, **kwargs):
	if DEBUG:
		print(*args, **kwargs)

def rint():
	return int(input())

def rlist(f=int):
	return list(map(f, input().split()))

def rstr():
	return input()

class Solution:

	def __init__(self):
		pass

	def run(self):
		(n, k1, k2) = map(int, input().split())
		(w, b) = map(int, input().split())
		if k1 + k2 < 2 * w:
			return 'NO'
		if 2 * n - (k1 + k2) < 2 * b:
			return 'NO'
		return 'YES'
t = int(input())
s = Solution()
for i in range(t):
	print(s.run())


import sys
import math
import bisect
import collections
input = sys.stdin.readline

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

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

def inpstrlist():
	s = input()
	return list(s[:len(s)])

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

def printlist(var):
	sys.stdout.write(' '.join(map(str, var)) + '\n')
t = int(input())
for _ in range(t):
	(n, k1, k2) = invr()
	(w, b) = invr()
	(f1, f2) = (0, 0)
	if k1 + k2 >= 2 * w:
		f1 = 1
	if 2 * n - k1 - k2 >= 2 * b:
		f2 = 1
	if f1 == 1 and f2 == 1:
		print('YES')
	else:
		print('NO')


def solve():
	(n, k1, k2) = [int(i) for i in input().split(' ')]
	(w, b) = [int(i) for i in input().split(' ')]
	if k1 == k2:
		if w <= k1 and b <= n - k1:
			return 'YES'
		else:
			return 'NO'
	if abs(k1 - k2) % 2 == 0:
		a = abs(k1 - k2) // 2
	else:
		a = (abs(k1 - k2) - 1) // 2
	if w <= min(k1, k2) + a and b <= n - max(k1, k2) + a:
		return 'YES'
	else:
		return 'NO'
for t in range(int(input())):
	print(solve())


n = int(input())
for i in range(n):
	s = input().split(' ')
	s = list(map(int, s))
	wb = input().split()
	(w, b) = map(int, wb)
	if (s[1] + s[2]) // 2 >= w and (2 * s[0] - s[1] - s[2]) // 2 >= b:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	(n, k1, k2) = input().split()
	n = int(n)
	k1 = int(k1)
	k2 = int(k2)
	(w, b) = input().split()
	w = int(w)
	b = int(b)
	if k1 + k2 >= 2 * w and n - k1 + (n - k2) >= 2 * b:
		print('YES')
	else:
		print('No')


T = int(input())
for t in range(T):
	(n, k1, k2) = [int(i) for i in input().split(' ')]
	(w, b) = [int(i) for i in input().split(' ')]
	wTot = int((k1 + k2) / 2)
	bTot = int((2 * n - k1 - k2) / 2)
	if bTot >= b and wTot >= w:
		print('YES')
	else:
		print('NO')


def count_place(data):
	n = data[0]
	k1 = data[1]
	k2 = data[2]
	white_pos = min(k1, k2) + abs(k1 - k2) // 2
	black_pos = min(n - k1, n - k2) + abs(k2 - k1) // 2
	return (white_pos, black_pos)
boards = []
domin = []
times = int(input())
for _ in range(times):
	boards.append([int(i) for i in input().split()])
	domin.append([int(i) for i in input().split()])
for i in range(times):
	res = count_place(boards[i])
	if res[0] >= domin[i][0] and res[1] >= domin[i][1]:
		print('YES')
	else:
		print('NO')


def solve(n, k1, k2, w, b):
	comp_w = min(k1, k2)
	comp_b = min(n - k1, n - k2)
	if w <= comp_w and b <= comp_w:
		print('YES')
		return
	else:
		w -= comp_w
		b -= comp_b
	left = abs(k1 - k2)
	now_w = left // 2
	now_b = left // 2
	if w <= now_w and b <= now_b:
		print('YES')
		return
	else:
		print('NO')
t = int(input())
while t > 0:
	(n, k1, k2) = input().split()
	n = int(n)
	k1 = int(k1)
	k2 = int(k2)
	(w, b) = input().split()
	w = int(w)
	b = int(b)
	if w == 0 and b == 0:
		print('YES')
	elif k1 + k2 < 2 * w or n - k1 + n - k2 < 2 * b:
		print('NO')
	else:
		solve(n, k1, k2, w, b)
	t -= 1


from sys import stdin
_input = stdin.readline
(_range, _int, _min, _abs, _max) = (range, int, min, abs, max)

def solution():
	for _ in _range(_int(_input())):
		(n, k_1, k_2) = [_int(i) for i in _input().split()]
		(w, b) = [_int(i) for i in _input().split()]
		w_ans = _min(k_1, k_2) + _abs(k_1 - k_2) // 2
		b_ans = n - _max(k_1, k_2) + _abs(k_1 - k_2) // 2
		if w_ans >= w and b_ans >= b:
			print('YES')
		else:
			print('NO')
solution()


t = int(input())
for _ in range(t):
	l1 = list(map(int, input().split()))
	l2 = list(map(int, input().split()))
	(n, k1, k2) = (l1[0], l1[1], l1[2])
	(w, b) = (l2[0], l2[1])
	white = k1 + k2
	black = n - k1 + (n - k2)
	if white // 2 >= w and black // 2 >= b:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	a1 = [int(_) for _ in input().split()]
	a2 = [int(_) for _ in input().split()]
	t = 2 * a1[0]
	w = a1[1] + a1[2]
	b = t - w
	if w // 2 >= a2[0] and b // 2 >= a2[1]:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	(n, k1, k2) = map(int, input().split())
	(w, b) = map(int, input().split())
	w1 = k1 + k2
	b1 = n + n - k1 - k2
	if w1 >= 2 * w and b1 >= 2 * b:
		print('YES')
	else:
		print('NO')


import sys
input = sys.stdin.buffer.readline
for t in range(int(input())):
	(N, A, B) = map(int, input().split())
	(X, Y) = map(int, input().split())
	(C, D) = (N - A, N - B)
	(V, W) = (min(A, B), min(C, D))
	A -= V
	B -= V
	C -= W
	D -= W
	if (A + B >> 1) + V >= X and (C + D >> 1) + W >= Y:
		print('YES')
	else:
		print('NO')


import sys
input = iter(sys.stdin.read().splitlines()).__next__

def solve(N, K1, K2, W, B):
	if W + B > N:
		return False
	dif = max(K1, K2) - min(K1, K2)
	if W > dif // 2 + min(K1, K2):
		return False
	if B > dif // 2 + N - max(K1, K2):
		return False
	return True
TC = int(input())
for tc in range(TC):
	(N, K1, K2) = map(int, input().split())
	(W, B) = map(int, input().split())
	res = solve(N, K1, K2, W, B)
	print('YES' if res else 'NO')


tc = int(input())
for t in range(tc):
	(n, k1, k2) = (int(x) for x in input().split())
	(w, b) = (int(x) for x in input().split())
	wcnt = k1 + k2
	bcnt = 2 * n - wcnt
	if 2 * w <= wcnt and 2 * b <= bcnt:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(0, t):
	inputs1 = [int(num) for num in input().split()]
	n = inputs1[0]
	k1 = inputs1[1]
	k2 = inputs1[2]
	k3 = n - k1
	k4 = n - k2
	inputs2 = [int(num) for num in input().split()]
	w = inputs2[0]
	b = inputs2[1]
	horimaxw = min([k1, k2])
	k1 -= horimaxw
	k2 -= horimaxw
	c1 = 0
	c2 = 0
	if k1 != 0:
		c1 = k1 // 2
	elif k2 != 0:
		c1 = k2 // 2
	maxw = horimaxw + c1
	horimaxb = min([k3, k4])
	k3 -= horimaxb
	k4 -= horimaxb
	if k3 != 0:
		c2 = k3 // 2
	elif k4 != 0:
		c2 = k4 // 2
	maxb = c2 + horimaxb
	if w <= maxw and b <= maxb:
		print('YES')
	else:
		print('NO')


from collections import Counter
import string
import math
import sys
from fractions import Fraction

def array_int():
	return [int(i) for i in sys.stdin.readline().split()]

def vary(arrber_of_variables):
	if arrber_of_variables == 1:
		return int(sys.stdin.readline())
	if arrber_of_variables >= 2:
		return map(int, sys.stdin.readline().split())

def makedict(var):
	return dict(Counter(var))
testcases = vary(1)
for _ in range(testcases):
	(n, k1, k2) = vary(3)
	(w, b) = vary(2)
	maxw = min(k1, k2) + (max(k1, k2) - min(k1, k2)) // 2
	maxb = min(n - k1, n - k2) + (max(n - k1, n - k2) - min(n - k1, n - k2)) // 2
	if maxb >= b and maxw >= w:
		print('YES')
	else:
		print('NO')


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

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

def main():
	for ii in range(int(input())):
		(N, k1, k2) = mapIn()
		(w, b) = mapIn()
		x = min(k1, k2)
		y = (max(k1, k2) - x) // 2
		z = 2 * N - k1 - k2
		z = z // 2
		p = x + y
		if w > p or b > z:
			print('NO')
		elif w + b > N:
			print('NO')
		else:
			print('YES')
main()


def domino(nkk, wbb):
	n = nkk[0]
	w = [nkk[1], nkk[2]]
	b = [abs(nkk[1] - n), abs(nkk[2] - n)]
	max_w = min(w) + abs(w[1] - w[0]) // 2
	max_b = min(b) + abs(b[1] - b[0]) // 2
	if max_w >= wbb[0] and max_b >= wbb[1]:
		return 'YES'
	else:
		return 'NO'
result = []
t = int(input())
for i in range(t):
	nkk = list(map(int, input().rstrip().split()))
	wb = list(map(int, input().rstrip().split()))
	result.append(domino(nkk, wb))
for i in result:
	print(i)


for _ in range(int(input())):
	(n, k1, k2) = [int(x) for x in input().split()]
	(w, b) = [int(x) for x in input().split()]
	if (k1 + k2) // 2 < w or (2 * n - k1 - k2) // 2 < b:
		print('NO')
	else:
		print('YES')


t = int(input())
out = list()
for i in range(0, t):
	l = list(map(int, input().split()))
	(w, b) = map(int, input().split())
	area = 2 * l[0]
	white_area = l[1] + l[2]
	black_area = area - white_area
	a = white_area - w * 2
	b = black_area - b * 2
	if a >= 0 and b >= 0:
		out.append('YES')
	else:
		out.append('NO')
for i in out:
	print(i)


t = int(input())
for _ in range(t):
	(n, k1, k2) = map(int, input().split())
	(w, b) = map(int, input().split())
	(fw, fb) = (1, 1)
	x = min(k1, k2)
	y = max(k1, k2)
	if w > x:
		w -= x
		k = (y - x) // 2
		if w > k:
			fw = 0
	p = n - k1
	q = n - k2
	x = min(p, q)
	y = max(p, q)
	if b > x:
		b -= x
		k = (y - x) // 2
		if b > k:
			fb = 0
	if fw & fb:
		print('YES')
	else:
		print('NO')


import math
testcases = int(input())
nk = []
wb = []
for i in range(testcases):
	nk.append([int(k) for k in input().split()])
	wb.append([int(k) for k in input().split()])
for i in range(testcases):
	if min(nk[i][1], nk[i][2]) + math.floor(abs(nk[i][2] - nk[i][1]) / 2) < wb[i][0]:
		print('NO')
		continue
	if min(nk[i][0] - nk[i][1], nk[i][0] - nk[i][2]) + math.floor(abs(nk[i][0] - nk[i][2] - nk[i][0] + nk[i][1]) / 2) < wb[i][1]:
		print('NO')
		continue
	print('YES')


import os
import math
import sys
parse_input = lambda : sys.stdin.readline().rstrip('\r\n')

def func(n, k1, k2, w, b):
	total_cell = 2 * n
	n_w_cell = k1 + k2
	n_b_cell = total_cell - n_w_cell
	dom_w_cell = 2 * w
	dom_b_cell = 2 * b
	if (n_w_cell >= dom_w_cell) & (n_b_cell >= dom_b_cell):
		answer = 'YES'
	else:
		answer = 'NO'
	return answer

def main():
	n_cases = int(parse_input())
	for i in range(n_cases):
		(n, k1, k2) = [int(i) for i in parse_input().split()]
		(w, b) = [int(i) for i in parse_input().split()]
		print(func(n, k1, k2, w, b))
main()


def fun(k1, k2, x):
	total = min(k1, k2) + (max(k1, k2) - min(k1, k2)) // 2
	if total >= x:
		return 1
	else:
		return 0
for _ in range(int(input())):
	(n, k1, k2) = [int(i) for i in input().split()]
	(w, b) = [int(i) for i in input().split()]
	white = fun(k1, k2, w)
	black = fun(n - k1, n - k2, b)
	if white == 1 and black == 1:
		print('YES')
	else:
		print('NO')


from sys import stdin
input = stdin.readline
T = int(input())
for _ in range(T):
	(n, k1, k2) = map(int, input().split())
	(w, b) = map(int, input().split())
	board = [[1] * n for i in range(2)]
	c_w = (max(k2, k1) - min(k2, k1)) // 2 + min(k2, k1)
	c_b = (max(k2, k1) - min(k2, k1)) // 2 + (n - max(k2, k1))
	if w <= c_w and b <= c_b:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	(n, k1, k2) = list(map(int, input().split()))
	(w, b) = list(map(int, input().split()))
	a = (k1 + k2) // 2
	d = (2 * n - k1 - k2) // 2
	if w <= a and b <= d:
		print('YES')
	else:
		print('NO')


import sys
input = sys.stdin.readline

def print(x, end='\n'):
	sys.stdout.write(str(x) + end)
lines = int(input())
for i in range(lines):
	(n, k1, k2) = [int(x) for x in input().split()]
	(w, b) = [int(x) for x in input().split()]
	if w <= (k1 + k2) / 2 and b <= (2 * n - k1 - k2) / 2:
		print('YES')
	else:
		print('NO')


try:
	for _ in range(int(input())):
		(n, k, l) = map(int, input().split())
		(w, b) = map(int, input().split())
		wh = k + l
		bl = 2 * n - wh
		if wh // 2 >= w and bl // 2 >= b:
			print('YES')
		else:
			print('NO')
except:
	pass


import sys
input = sys.stdin.readline
t = int(input())
for you in range(t):
	l = input().split()
	n = int(l[0])
	k1 = int(l[1])
	k2 = int(l[2])
	l = input().split()
	w = int(l[0])
	b = int(l[1])
	n1 = (k1 + k2) // 2
	n2 = (2 * n - k1 - k2) // 2
	if w <= n1 and b <= n2:
		print('YES')
	else:
		print('NO')


t = int(input())
for p in range(t):
	(n, k1, k2) = map(int, input().split())
	(w, b) = map(int, input().split())
	w1 = abs(k1 - k2) // 2 + min(k1, k2)
	b1 = n - k1
	b2 = n - k2
	b3 = abs(b1 - b2) // 2 + min(b1, b2)
	if w <= w1 and b <= b3:
		print('YES')
	else:
		print('NO')


def test(k1, k2):
	w_ges = 0
	while k1 > 0 and k2 > 0:
		k1 -= 1
		k2 -= 1
		w_ges += 1
	while k2 > 1 or k1 > 1:
		if k2 > 1:
			k2 -= 2
			w_ges += 1
		else:
			k1 -= 2
			w_ges += 1
	return w_ges
for _ in range(int(input())):
	(n, k1, k2) = map(int, input().split())
	(w, b) = map(int, input().split())
	(b1, b2) = (n - k1, n - k2)
	w1 = test(k1, k2)
	b1 = test(b1, b2)
	if w1 >= w and b1 >= b:
		print('YES')
	else:
		print('NO')


def fun(ls, lt):
	(n, k1, k2) = ls
	(w, b) = lt
	total_box = n * 2
	max_white_domino = (k1 + k2) // 2
	max_black_domino = (total_box - (k1 + k2)) // 2
	if max_black_domino >= b and max_white_domino >= w:
		print('YES')
	else:
		print('NO')
T = int(input())
for i in range(T):
	ls = list(map(int, input().split()))
	lt = list(map(int, input().split()))
	fun(ls, lt)


import sys
input = sys.stdin.readline
t = int(input())
for tests in range(t):
	(n, k1, k2) = map(int, input().split())
	(w, b) = map(int, input().split())
	W = k1 + k2
	B = 2 * n - W
	if w <= W // 2 and b <= B // 2:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	arr1 = list(map(int, input().split()))
	arr2 = list(map(int, input().split()))
	n = arr1[0]
	k1 = arr1[1]
	k2 = arr1[2]
	w = arr2[0]
	b = arr2[1]
	if w == 0 and b == 0:
		print('yes')
		continue
	w_possible = min(k1, k2) + abs(k1 - k2) // 2
	b_possible = min(n - k1, n - k2) + abs(k1 - k2) // 2
	if w <= w_possible and b <= b_possible:
		print('yes')
	else:
		print('No')


from sys import stdin as f

def solution(n, k1, k2, w, b):
	w_count = 2 * k1 + (k2 - k1)
	b_count = 2 * (n - k1) + (k1 - k2)
	w_count = w_count // 2
	b_count = b_count // 2
	if w_count >= w and b_count >= b:
		return 'YES'
	else:
		return 'NO'
t = int(f.readline().strip())
for _ in range(t):
	(n, k1, k2) = [int(i) for i in f.readline().strip().split()]
	(w, b) = [int(i) for i in f.readline().strip().split()]
	print(solution(n, k1, k2, w, b))


from sys import stdin
input = stdin.readline

def ceil(c):
	if int(c) == c:
		return int(c)
	return int(c) + 1

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)

def floor(f):
	return int(f)

def sqrt(s):
	return s ** 0.5

def max(a, b):
	return a if a > b else b

def abs(a):
	return a if a >= 0 else -1 * a

def min(a, b):
	return a if a < b else b

def primeInRange(n):
	l = [True] * n
	for i in range(2, int(sqrt(n)) + 1):
		if l[i - 1]:
			for j in range(i + i, n + 1, i):
				l[j - 1] = False
	return l

def solve():
	(n, k1, k2) = map(int, input().split())
	(w, b) = map(int, input().split())
	n *= 2
	white = k1 + k2
	black = n - white
	if white // 2 >= w and black // 2 >= b:
		return 'YES'
	return 'NO'
for i in range(int(input())):
	print(solve())


for __ in range(int(input())):
	(n, k1, k2) = tuple(map(int, input().split()))
	(w, b) = tuple(map(int, input().split()))
	rw = k1 + k2
	rb = 2 * n - k1 - k2
	if rw < 2 * w or rb < 2 * b or 2 * n < 2 * (w + b):
		print('NO')
	elif rb == 2 * b or rw == 2 * w:
		if abs(k2 - k1) % 2 == 1:
			print('NO')
		else:
			print('YES')
	else:
		print('YES')