$N$ jumping beans stand in a row. Every second, one bean jumps. Your task is to determine the final arrangement of the beans after a given number of seconds.
To describe the process, give each bean a distinct uppercase letter and assume the beans initially stand in alphabetical order: A, B, C, and so on. For example, if $N = 4$ the beans start in the order ABCD.
BACD.ACBD.In general, at second $s$ the leftmost bean that has jumped the fewest times jumps, and it performs $s$ swaps in a row. Each swap exchanges the jumping bean with the bean immediately to its right. When the jumping bean is already in the rightmost position, its swap to the right wraps around: the bean moves to the leftmost position and every other bean shifts one place to the right.
Continuing from ACBD, the leftmost least-jumped bean is C. Because this is second 3, C swaps three times: ACBD → ABCD → ABDC → CABD. At second 4 it is D's turn. At second 5 every bean has jumped exactly once, so the bean that jumps is again the one standing in the leftmost position.
The program is tested on one or more test cases. Each test case is given on a single line containing an integer $T$ and a string $S$, where $0 < T < 10^9$ is the number of seconds and $S$ is the initial arrangement of the beans. $S$ is a non-empty string made of distinct uppercase letters ('A'...'Z').
The last test case is followed by a line containing a single 0.
For each test case, print one line:
k. S
where $k$ is the test case number (starting at 1) and $S$ is the arrangement of the beans after they have jumped for $T$ seconds.