import io.{StdIn => in}

object Main extends App {
  val out = new java.io.PrintWriter(System.out)
  val Array(h, w) = in.readLine.split(" ").map(_.toInt)
  Iterator.continually(in.readLine)
    .take(h)
    .foreach(s => {
      out.println(s)
      out.println(s)
    })
  out.flush
}