Tom and Jerry are playing a pile game and they are provided with a number K. The game is played on a pile of cheese blocks and each of them can eat 1, 2, 3, or ... up to K cheese blocks and who ever is not able to eat is declared as the looser of the game. Initially, there is no pile in front of them but as time progresses more piles of cheese blocks are added.
Tom is asked the total of Q operations to perform in the game. This includes additional operations and also some questions. The operations and questions are as follows:
Input format
Output format
The answer for the following types of questions:
Constraints
1≤Q≤2e51≤K≤101≤x≤1000000000
After 1st,2nd and 3rd operation the array is [10,9,14]
The answer to 4th query is 2
The answer to 5th query is Tom
After 6th operation the array is [18,17,14]
After 7thoperation the array is [12,18,17,14]
After 8th operation the array is [12,18,8,14]
The answer to 9th query is 0
The answer to 10th query is Jerry