Internet Problem Solving Contest

IPSC 2005

Problem R – 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 specification

The input file describes several cases; the number of the cases is given on the first line. 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. The sentence is composed only from letters and does not contain any punctuacion or spaces.

Output specification

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.)


1 IWantToSleep

Problemsetter(s): Martin
Contest-related materials: Martin, Palo