By Lucas Bucior, beecrowd Brazil
This year Santa Claus received several lists of gifts, requests and more applications to make, all lists are encoded by elves. As there are thousands of lists and Santa is organized, decided to ask for your help, how does he know that you are dedicated and you know the standard decoding of the elves, released 26 gnomes and goblins 676. Each list is decoded through collaboration of gnomes and elves helpers of Santa Claus. The gnomes are listed from 1 to 26 and for each Gnome, 26 goblins that correspond to letters from A to Z (including the letters K, W, Y). When the decoding is initiated, every N rows are performed. Each line corresponds to a gift. Follow the steps to decode a given list created by Elves:
2nd For each gnome, is found a goblin. For example if the integer i is 2 (line 2) the gnome is 2, the goblin is also 2, therefore corresponds to character B.
3rd All the elves, at the gnome position should be moved to the end.
4th The gnome line must be moved to the last valid position.
For the next integer number, note that if it is 2 (line 2) the gnome now is 3, as well the Elf (3), therefore corresponding to the character D.
The first step is to run each new hard-coded list for elves, the 2nd, 3rd and 4th step are performed for each integer i corresponds to the row of the matrix. Let Santa know the gifts that contains the encoded list by elves.
The first line of each test case contains an integer N (1 ≤ N≤ 10000), that corresponds to the number of lines coded by elves. The N lines contains an indefinite number of integers i (1 ≤ i ≤ 27), each integer i represents the row of the array, and if i is 27, a space. The entry ends with end-of-file (EOF).
For each list encoded by elves, you must submit the message “LISTA #X:”, where X is the number of the list following the sequence (1, 2, 3, ...), then you must list all alphabetically and capital gifts, one in each line. Print a blank line between two consecutive test cases. At the end of the exit there should be a blank line.
|Input Sample||Output Sample|