#K52352. Determine the Game Winner
Determine the Game Winner
Determine the Game Winner
Two players are playing a stone game. There are two piles of stones. The first pile has N stones and the second pile has M stones. The winner is determined based on the greatest common divisor (GCD) of N and M. Specifically, if \(\gcd(N, M) = 1\), then the first player wins; otherwise, the second player wins.
Your task is to determine the winner given the values of N and M for multiple test cases. Read the input from standard input (stdin) and print the results to standard output (stdout).
Input Format
The first line of input contains an integer T representing the number of test cases. Each of the following T lines contains two integers N and M separated by a space.
Output Format
For each test case, output First
if the first player wins (i.e. when \(\gcd(N, M) = 1\)); otherwise, output Second
. Each result should be printed on a new line.
inputFormat
The first line contains an integer T (1 ≤ T ≤ 105), the number of test cases. Each of the next T lines contains two positive integers N and M (1 ≤ N, M ≤ 109), representing the number of stones in the first and second piles respectively.
outputFormat
For each test case, output a single line containing the string First
if the first player wins (when \(\gcd(N, M) = 1\)), otherwise output Second
.
1
5 3
First
</p>