import Control.Monad

main :: IO ()
main = do
  [n, m] <- map (read :: String -> Int) . words <$> getLine
  strs <- replicateM n getLine
  mapM_ putStrLn $ solve n strs

solve :: Int -> [String] -> [String]
solve n ss = foldr (\a b -> a : a: b) [] ss