Problem D
Rotate and Cut
Thomas is the best student in his class. One would think that it is fantastic for him to know all the stuff their teacher is speaking about... but unfortunately, he keeps becoming very very bored during the lessons. To prevent himself from falling asleep he draws silly drawings into his notebook, solves funny riddles, plays with paper and so on... A few minutes ago he wrote a long sentence on a slip of paper and now and then he flips the slip (so that the sentence becomes reversed and upside-down) and cuts off one quarter of letters (rounding down if necessary) from the right side of the remaining part of the slip.
However, the teacher does not like students that do not pay attention during his lectures. So as soon as he noticed Thomas is playing with the slip of paper he seized it. Bored Thomas would like to continue his game. To do this, however, he needs to know what exactly was written on the slip at the moment it was seized. Naturally, he remembers the original sentence and the number of rotate&cuts.
Input
The input file describes several cases; the number of the cases is given on the first line and is at most 200.
For each case there is one line describing it. The line starts with an integer $N$ – the number of Thomas’s rotate&cuts, followed by a space and the original sentence Thomas wrote on the slip. You may assume that $N$ is at most 1 000 000 000. The sentence is composed only from lowercase and uppercase letters and has at most 2000 characters.
Output
For every case output one line containing the remaining part of the sentence after the specified number of rotate&cuts. (Even if the sentence ended upside down, output it in the way we would read it.)
Sample Input 1 | Sample Output 1 |
---|---|
2 1 IWantToSleep 2 ZZZ |
ntToSleep ZZZ |