let pair f s = s |>
               Str.split (Str.regexp " ") |>
               List.map f |>
               (function | [a; b] -> (a, b)
                         | _ -> failwith "invalid input")

let box (h, w) =
  let rec rows i acc =
    let row = (String.make w '#') ^ "\n" in
    if i > 0 then rows (i-1) (row :: acc) else acc in
  String.concat "" (rows h [])

let rec loop () =
  match read_line () with
  | "0 0" -> ()
  | line -> loop (print_endline (box (pair int_of_string line)))

let () = loop ()