import Data.List
import Data.Ord
import Data.Char
import Data.Ratio
import Data.Maybe

main = do
  s <- tail . map words . lines <$> getContents
  tatenaga s

tatenaga s = (putStrLn . unlines . words . unwords . map unwords . zipWith (++) s) s