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


    stop
contains
end program prob2