m@main=getLine>>=putStrLn.unwords.f.map read.words>>m f[m,n]=n#[1..m]where 1#(a:x)=show a:n#x;n+1#(a:x)=n#(x++[a]);_#_=[]