The Game

4

1 votes
Problem

Rio and Tokyo are in a heist (a bank robbery). There is 24 hrs more left for the robbery. Now they two wanted to play a game. The one who wins the game will get more share from robbery. They will be playing the game with the following rules :

  • Initially ,Professor will give an integer sequence A1 ,A2 , A, ..............,AN, in addition Rio has a luky number a and Tokyo has a lucky number b.
  • The players alternate turns, in each turn, the current player must remove a non-zero number of elements from the sequence, each removed element should be a multiple of the lucky number of this player.
  • If it is impossible to remove any elements, the current player loses the game.

So one Player must win the game after a finite number of turns. Find the winner of the game if Rio plays first.

Note : Assume Both players play optimally.

Input :

  • The first line of the input contains a single integer T denoting the number of test cases. The description of T  test cases follows.
  • The first line of each test case contains three space-separated integers N, a and b.
  • The second line contains N space-separated integers A1,A2,…,ANA1,A2,…,AN.

Output :

For each test case, print a single line containing the string "Rio" if the winner is Rio or "Tokyo" if the winner is Tokyo (without quotes).

Constraints :

1<=T<=10

1<=N<=2.105

1<=a,b<=100

1<=Ai<=109

Sample Input
2
5 3 2
1 2 3 4 5
5 2 4
1 2 3 4 5
Sample Output
Tokyo
Rio
Time Limit: 1
Memory Limit: 256
Source Limit:
Explanation

Example case 1: Rio removes 3 and the sequence becomes [1,2,4,5]. Then, Tokyo removes 2 and the sequence becomes [1,4,5]. Now, Rio is left with no moves, so Tokyo is the winner.

Contributers:
Editor Image

?