twotime::[a]->[a]
twotime [] =[]
twotime (x:xs)= x:x:(twotime xs)

solver::[[Char]]->[[Char]]
solver x = twotime (map twotime x)

--hight -> width -> do
get_pic::Int -> Int -> IO [[Char]]
get_pic 0 _ = return []
get_pic h w = do
  d<-getLine
  rest<-get_pic (h-1) w
  return  (((take w) d):rest)

n_line_print::[[Char]]-> IO ()
n_line_print []=return ()
n_line_print (x:xs)=do
  putStr (x++"\n")
  n_line_print xs

main::IO()
main =do
  hwc<-getLine
  let h:w:[] = map read ( words hwc)::[Int]
  cll<-get_pic h w
  n_line_print (solver cll)
