import scala.io.StdIn

object Main extends App {

  val Array(h, w) =  StdIn.readLine().split(" ").map(_.toInt)
  val pict = (0 until h).map { _ => StdIn.readLine()}.toList
  val pict2 = pict.flatMap(s => List(s,s ))
  
  pict2.foreach(println)
  
}
