#K35867. Knight's Tour Possibility

    ID: 25627 Type: Default 1000ms 256MiB

Knight's Tour Possibility

Knight's Tour Possibility

Given an (N \times N) chessboard and a starting position ((x, y)), determine whether there exists a valid Knight's Tour that visits every cell exactly once starting from the given cell. A Knight's Tour is a sequence of moves by a knight in chess such that all squares on the chessboard are visited exactly one time.

Note that the knight moves in an 'L'-shape: two squares in one direction and one square perpendicular to that direction. For every test case, output "Yes" if a complete tour is possible; otherwise, output "No".

inputFormat

Input is read from standard input (stdin). The first line contains an integer (T) representing the number of test cases. Each of the next (T) lines contains three space-separated integers: (N), (x), and (y) where (N) is the board size and ((x, y)) is the starting coordinate (0-indexed).

outputFormat

For each test case, print a single line containing either "Yes" if a knight's tour is possible, or "No" otherwise. The output is produced on standard output (stdout).## sample

1
1 0 0
Yes

</p>