#K11471. Grid Game Winner Determination
Grid Game Winner Determination
Grid Game Winner Determination
In this problem, two players compete on grids of varying sizes. For each game, a grid with dimensions \(n\) and \(m\) is provided. The rule is simple: if either \(n\) or \(m\) is odd, then Player 1 wins; otherwise, if both dimensions are even, Player 2 wins. Your task is to determine the winner for each provided test case.
Game Rule:
- If \(n\) is odd or \(m\) is odd, then the winner is "Player 1".
- If both \(n\) and \(m\) are even, then the winner is "Player 2".
For example, given a \(2 \times 2\) grid, the output should be "Player 2"; for a \(3 \times 3\) grid, the output should be "Player 1".
inputFormat
The first line of input contains an integer \(T\) (the number of test cases). Each of the next \(T\) lines contains two space separated integers \(n\) and \(m\), which represent the dimensions of the grid for that test case.
Input Format:
T n1 m1 n2 m2 ... nT mT
outputFormat
For each test case, output a single line indicating the winner of the game. Output "Player 1" if either dimension is odd, otherwise output "Player 2".
Output Format:
Result1 Result2 ... ResultT## sample
1
2 2
Player 2
</p>