Reverse BWT by hiro.suzuki 

while 1:n,x=raw_input().split();S=x;exec"S=zip(x,*zip(*sorted(S)));"*len(x);print`S[int(n)]`[7::5]

Note that non-ascii characters in the above source code will be escaped (such as \x9f).

download

return top