Two players are playing a game on a chessboard. The rules of the game are as follows:
The game starts with a single coin located at some coordinates. The coordinates of the upper left cell are , and of the lower right cell are .
In each move, a player must move the coin from cell to one of the following locations:
Note: The coin must remain inside the confines of the board.
Beginning with player 1, the players alternate turns. The first player who is unable to make a move loses the game.
The figure below shows all four possible moves using an board for illustration:
Given the initial coordinates of the players' coins, assuming optimal play, determine which player will win the game.
Complete the chessboardGame function in the editor below. It should return a string, either First or Second.
chessboardGame has the following parameter(s):
x: an integer that represents the starting column position
y: an integer that represents the starting row position
The first line contains an integer , the number of test cases.
Each of the next lines contains space-separated integers and .
On a new line for each test case, print if the first player is the winner. Otherwise, print .
In the first case, player1 starts at the red square and can move to any of the blue squares. Regardless of which one is chosen, the player 2 can move to one of the green squares to win the game.
In the second case, player 1 starts at the red square and can move to any of the blue squares or the purple one. Moving to the purple one limits player 2 to the yellow square. From the yellow square, player 1 moves to the green square and wins.