import Control.Monad
import qualified Data.ByteString.Char8 as BS
import Data.Maybe (fromJust)
import Data.List

solve :: [String] -> [String]
solve [] =[]
solve (x:xs) = x:x:(solve xs)

main :: IO ()
main = do
    [h, w] <- map (fst . fromJust . BS.readInt) . BS.words <$> BS.getLine
    c <- replicateM h (BS.unpack <$> BS.getLine)
    let s = solve c
    forM_ s putStrLn
