import Control.Applicative
import Control.Monad

printDouble :: String -> IO ()
printDouble str = putStrLn $ str ++ "\n" ++ str

main = do
  [h, w] <- (map read . words) <$> getLine
  c <- replicateM h getLine
  mapM_ printDouble c
