let stretch img =
	let rec f = function
		| [] -> []
		| x::xs -> x::x::f xs
	in
		img |> f |> List.rev

let rec read = function
	| 0 -> []
	| n -> read_line () :: read (n - 1)

let rec print = function
	| [] -> () 
	| x::xs -> print_string x;print_newline ();print xs

let _ =
	Scanf.scanf "%d %d" (fun h w -> read h) |> stretch |> print
