import java.util.Scanner

object Main extends App{
  val sc = new Scanner(System.in)
  val h = sc.nextInt
  val w = sc.nextInt

  val cl = List.fill(h)(sc.next)
  
  cl.foreach { str =>
    println(str)
    println(str)
  }
}