main=interact$unlines.f"";f x(n:m)=f(' ':x)m++[x++unwords[[y]|y<-n:m]++x];f _ _=[]