CF2055A.Two Frogs

传统题 时间 2000 ms 内存 256 MiB 3 尝试 1 已通过 1 标签

Two Frogs

Roaming through the alligator-infested Everglades, Florida Man encounters a most peculiar showdown.

There are nn lilypads arranged in a row, numbered from 11 to nn from left to right. Alice and Bob are frogs initially positioned on distinct lilypads, aa and bb, respectively. They take turns jumping, starting with Alice.

During a frog's turn, it can jump either one space to the left or one space to the right, as long as the destination lilypad exists. For example, on Alice's first turn, she can jump to either lilypad a1a-1 or a+1a+1, provided these lilypads are within bounds. It is important to note that each frog must jump during its turn and cannot remain on the same lilypad.

However, there are some restrictions:

  • The two frogs cannot occupy the same lilypad. This means that Alice cannot jump to a lilypad that Bob is currently occupying, and vice versa.
  • If a frog cannot make a valid jump on its turn, it loses the game. As a result, the other frog wins.

Determine whether Alice can guarantee a win, assuming that both players play optimally. It can be proven that the game will end after a finite number of moves if both players play optimally.

Input

Each test contains multiple test cases. The first line contains the number of test cases tt (1t5001 \le t \le 500). The description of the test cases follows.

The first and only line of each test case contains three integers nn, aa, and bb (2n1002 \leq n \leq 100, 1a,bn1 \leq a, b \leq n, aba\neq b) — the number of lilypads, and the starting positions of Alice and Bob, respectively.

Note that there are no constraints on the sum of nn over all test cases.

Output

For each test case, print a single line containing either "YES" or "NO", representing whether or not Alice has a winning strategy.

You can output the answer in any case (upper or lower). For example, the strings "yEs", "yes", "Yes", and "YES" will be recognized as positive responses.

Note

In the first test case, Alice has no legal moves. Therefore, Alice loses on the first turn.

In the second test case, Alice can only move to lilypad 22. Then, Bob has no legal moves. Therefore, Alice has a winning strategy in this case.

In the third test case, Alice can only move to lilypad 11. Then, Bob can move to lilypad 22. Alice is no longer able to move and loses, giving Bob the win. It can be shown that Bob can always win regardless of Alice's moves; hence, Alice does not have a winning strategy.

Samples

5
2 1 2
3 3 1
4 2 3
5 2 4
7 6 2
NO
YES
NO
YES
YES

在线编程 IDE

建议全屏模式获得最佳体验