There are n stacks, each containing k positive integers not exceeding 109. You play a game with the jury program. Initially you know only the topmost value of each stack. Game proceeds as follows:
In all tests except sample n=10,000, k=10. Your task is to clear all stacks in no more than 50 moves.
Note that the jury program is adaptive, i.e. stack contents are not fixed and may change "on the run" depending on the output of your program.
In the sample test there are four fixed stacks of size 2:
1 2 3 4
5 6 7 8
Next we describe the interaction example as shown in "Example" section. Note that, although the stacks are fixed, the interactor in the system may behave not exactly in this way even if you ask the same queries.
In the first query x=2 and R= "≤". After the query numbers 1 and 2 are removed and stacks look like this:
3 4
5 6 7 8
In the second query x=4 and R= "≥". Numbers 5, 6 and 4 are removed, and the stacks' state is:
3
7 8