Hearthstone Battlegrounds
时间限制:C/C++/Rust/Pascal 1秒,其他语言2秒
空间限制:C/C++/Rust/Pascal 256 M,其他语言512 M
64bit IO Format: %lld

题目描述

"Murlocs tend to be stronger in the early game, whereas Mechs are stronger in the late game."
xtq loves to play hearthstone battlegrounds. He noticed that only murlocs can beat murlocs in the late game. So he wonders when he can win if they both have murlocs. Note that in this problem the rules are different from the real game.
To simplify the problem, there are only four kinds of murlocs —
1. with poisonous, divine shield and deathrattle that summon a 1/1 plant.
2. with poisonous and divine shield.
3. with poisonous and deathrattle that summon a 1/1 plant.
4. with poisonous.

x/y represents a minion with x attack and y health. When a minion attacks another minion, they will deal damage to each other, and the damage they deal is equal to their attack. Formally, if a minion with attacks a minion with , then y_1 will become y_1-x_2, and y_2 will become y_2-x_1, if neither of these two minions has a divine shield. And if a minion's health becomes lower or equal to 0, it is destroyed. The followings are the explanation of the keywords:
- Poisonous: Destroys the enemy if it is damaged by the minion.
- Divine Shield: Grants unit invulnerability against exactly one attack.
- Deathrattle: An ability activates when the minion is destroyed.
The plant is a kind of minion without special ability.
Note that if a minion with a poisonous attack a minion with divine shield, the minion with divine shield won't die, but its divine shield will disappear. Each turn, a minion will attack an enemy minion. They will attack each other until one of the players has no minions. If xtq still has at least one minion at the end of the game, xtq will win the game. It's too difficult to predict the result of the game if minions attack randomly. But fortunately, xtq has very good luck, so if it is possible to win, he can win the game, no matter how small the probability is. You can look at the explanation of the example to have a better understanding of the rules.
xtq now has a_i murlocs of kind i, and his opponent has b_i murlocs of kind . You need to find that if xtq can win or not.

输入描述:

The first line contains one integer T  — the number of test cases.
The first line of each test case contains four integers , which represent the number of each kind of murlocs xtq has at first.
The second line of each test case contains four integers , which represent the number of each kind of murlocs xtq's opponent has at first.
The sum of over all test cases does not exceed .

输出描述:

Print T lines — for each test case print "Yes" if xtq can win or "No" if xtq can't (without quote).
示例1

输入

复制
3
1 0 1 0
1 0 1 0
1 0 0 1
0 1 1 0
1 0 0 1
1 0 1 0

输出

复制
Yes
Yes
No

备注:

For the first test case, let s_1 be the xtq's first kind of murloc, s_2 be the xtq's third kind of murloc, t_1 be the enemy's first kind of murloc, t_2 be the enemy's third kind of murloc. Then xtq can do the following operations to win the game:
- Let s_2 attack t_2, then they will both be destroyed and summon a 1/1 plant, call them s_3 and t_3.
- Let s_3 attack t_1, then the divine shield of t_1 will disappear, and s_3 will be destroyed.
- Let s_1 attack t_1, then the divine shield of s_1 will disappear, note that t_1 now has no divine shield, so it will die and summon a 1/1 plant, call it t_4.
- Let s_1 attack t_3, then t_3 will be destroyed.
- Let s_1 attack t_4, then t_4 will be destroyed.
After these operations, s_1 is still on the board but xtq's enemy now has no minions, so xtq can win the game.
For the second test case, let s_1 be the xtq's first kind of murloc, s_2 be the xtq's fourth kind of murloc, t_1 be the enemy's second kind of murloc, t_2 be the enemy's third kind of murloc. Then xtq can do the following operations to win the game:
- Let s_1 attack t_1, then their divine shields will both disappear.
- Let s_1 attack t_2, then they will both die and summon a 1/1 plant, call them s_3 and t_3.
- Let s_2 attack t_3, then t_3 will be destroyed.
- Let s_2 attack t_1, then they will both be destroyed.
After these operations, s_3 is on the board but xtq's enemy now has no minions, so xtq can win the game.
For the third test case, no matter how the minions attack, xtq can't win the game.