#C9844. Rock Paper Scissors Tournament
Rock Paper Scissors Tournament
Rock Paper Scissors Tournament
This problem simulates a Rock-Paper-Scissors tournament. In each tournament, players are paired off and compete in successive rounds until only one winner remains. In each match, if both players choose the same strategy, the first player's strategy is declared the winner. Otherwise, the winning conditions are:
\(Rock \succ Scissors, \quad Scissors \succ Paper, \quad Paper \succ Rock\)
Moreover, if a player's strategy is Random, it is deterministically treated as Rock. It is guaranteed that the number of players in any test case is a power of two.
Given multiple test cases, your task is to simulate the tournament for each test case and output the winning strategy.
inputFormat
The input begins with an integer T (\(T \ge 1\)), representing the number of test cases. Each of the following T lines contains space-separated strings, each of which is one of the following: Rock
, Paper
, Scissors
, or Random
. Each line represents a tournament where the players' strategies are listed in the order they compete.
outputFormat
For each test case, output a single line containing the winning strategy after simulating the tournament.
## sample1
Rock Paper Scissors Random
Paper
</p>