program main
  implicit none
  integer :: h, w, i
  character(100) :: s
  read (*, *) h, w
  do i = 1, h
    read (*, *) s
    write (*, "(a)") trim(s)
    write (*, "(a)") trim(s)
  end do
end program main
