main=interact$head.foldr(\x(y:z)->zipWith(:)x$z++repeat y)[[]].lines