import List main=interact$unlines.t.t.t.t.lines t=snd.span(cycle" ">).reverse.transpose