Universal Cup Judging System

Universal Cup

Süre Sınırı: 1 s Bellek Sınırı: 1024 MB
İstatistikler

VegiCat and VegiDog are playing a special duel in Slay the Spire. VegiCat plays as Watcher A, and VegiDog plays as Watcher B. A and B have base attack powers $a$ and $b$ and initial health values $h_A$ and $h_B$, respectively.

problem_23595_17aa2d8990609c5348c9bf4e9d000ebd.png

At the start of each round, the game determines each Watcher's stance for that round. Each Watcher can be in one of the following two stances:

  • Normal: damage dealt and damage received are unchanged.
  • Wrath: damage dealt and damage received are both doubled.

For each attack, the damage initially equals the attacker's base attack power. It is doubled if the attacker is in Wrath and doubled again if the defender is in Wrath. Thus, the damage in each round is as follows:

  • If both characters are in Normal, A deals $a$ damage to B, and B deals $b$ damage to A.
  • If exactly one character is in Wrath, A deals $2a$ damage to B, and B deals $2b$ damage to A.
  • If both characters are in Wrath, A deals $4a$ damage to B, and B deals $4b$ damage to A.

Each round, both characters attack once simultaneously, and both health values decrease simultaneously. Both attacks take effect even if either character's health becomes $0$ or less during the round. At the end of the round, a character with health less than or equal to $0$ dies. If either character dies, the battle ends immediately; otherwise, the next round begins. Base attack powers never change, and health is never restored.

The stances for each round are determined by the game, not by the players. Any combination of the two characters' stances is possible in each round.

VegiCat wins only if B dies while A remains alive. If both characters die in the same round, VegiCat does not win. Determine whether VegiCat will win regardless of how both characters' stances change.

Input

The first line contains an integer $T$ ($1 \le T \le 10^5$), the number of test cases. The description of the test cases follows.

Each test case contains one line with four integers $a$, $b$, $h_A$, and $h_B$ ($1 \le a, b, h_A, h_B \le 10^{18}$), giving the characters' base attack powers and initial health values, respectively.

Output

For each test case, output YES if VegiCat will win regardless of how both characters' stances change, and NO otherwise. Output each answer on a separate line.

You can output the answer in any case. For example, yEs, yes, Yes, and YES are all accepted as positive responses.

Examples

Input 1

5
1 1 5 1
1 1 4 1
1 1 1 1
1 1 1 5
2 3 13 2

Output 1

YES
NO
NO
NO
YES

Input 2

4
3 2 18 13
3 2 16 13
3 2 9 13
3 2 17 13

Output 2

YES
NO
NO
YES

Note

In the first test case of the first sample, B always dies in the first round. A receives at most $4$ damage in that round and remains alive.

In the second test case of the first sample, A wins if both characters are normal in the first round. If both characters are in Wrath in the first round, both die. Therefore, the answer is NO.

In the second test case of the second sample, if both characters are normal for the first $4$ rounds, their remaining health values are $8$ and $1$. If both enter Wrath in round $5$, both die, so victory is not guaranteed.

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.