import List main=interact$unlines.g.g.lines;f=reverse.snd.span(all(==' '));g=transpose.f.f