Building the Robot Convergence Hall
Time limit2sMemory limit1024 MB
Given N columns and M floors, decide whether Minjae should move first or second to force a fully blue row or column in a block-placing game.
- Level
Medium6 of 10
- Topics
- Game theory, Math
- Solved
- No attempts yet
Problem
While walking to the Robot Convergence Hall at Korea University with Junhyeok, Minjae wondered about something and had this conversation with him.
- Minjae: Why is it called the Robot Convergence Hall?
- Junhyeok: Probably because robots built the building.
- Minjae: Wow, really?
Minjae, an algorithm enthusiast, became curious about which construction algorithm was used to build the Robot Convergence Hall. To find out, he visited his senior Junhyeok and asked him to explain the algorithm. Junhyeok said he would teach it if Minjae beat him in the following game.
- A rectangle is drawn on the ground. The rectangle is divided into adjacent squares, and the numbers 1 through are written on them from left to right.
- Two players take turns placing a unit cube block each. A block can be placed on any of the square positions. If a block is already stacked at the chosen position, the new block goes on top of it. However, the Robot Convergence Hall has floors, so the height of a stack cannot exceed .
- The first player always places a blue cube block, and the second player always places a red cube block.
- The game ends the moment all cube blocks are stacked. After the game, if there is a horizontal row or a vertical row that is entirely blue, the first player wins. If not, the second player wins.
Junhyeok lets Minjae choose whether to be the first or second player. However, Junhyeok is strict. He will teach the algorithm only if Minjae wins all games, which are played independently. For each game, given and , output which side Minjae must choose to win. Assume both players are skilled and always play optimally.
Input
The first line contains an integer , the number of games.
Each of the next lines contains two integers and , separated by a space, which describe the conditions of one game.
Output
For each game, print on its own line the side Minjae must choose under the given conditions. Print the answer for the -th game on the -th line.
Print First if Minjae must choose the first player, and Second if he must choose the second player.
Hint
The construction of the Robot Convergence Hall was actually carried out by robots. The game in the problem has nothing to do with the real construction of the building.