#P15746. [JAG 2024 Summer Camp #3] Paper Cut Game

[JAG 2024 Summer Camp #3] Paper Cut Game

题目描述

There is a sheet of paper consisting of a grid with NN rows and MM columns. Two players participate in a game with this paper.

Each player alternates moves, performing exactly one of the following actions on their turn.

  • Cut the paper vertically along one of the grid lines to split the paper into two, and keep only the part with more cells. If both parts have the same number of cells, keep only one of them.
  • Cut the paper horizontally along one of the grid lines to split the paper into two, and keep only the part with more cells. If both parts have the same number of cells, keep only one of them.

The player who is unable to make a move loses, while the other player wins. Given the size of the paper, determine the winner, assuming both players play optimally.

You have TT test cases to solve.

输入格式

The input consists of a multiple test case of the following format.

$$\begin{aligned} & T \\ & \text {case}_{1} \\ & \vdots \\ & \text {case}_{T} \end{aligned}$$

The first line contains an integer TT between 11 and 200,000200,000, inclusive.

The (i+1)(i+1)-th line corresponds to the ii-th test case. Each line contains two integers, NN and MM, representing the height and width of the paper, respectively. Both NN and MM are between 11 and 101810^{18}, inclusive.

输出格式

Print TT lines. For each test case, the ii-th line should contain First if the first player wins in the ii-th test case, and Second otherwise.

5
1 1
1 2
3 3
7 3
999999999999999999 1000000000000000000
Second
First
Second
Second
First