main = do
  s <- getContents
  putStrLn . join' "\n" . map rect . takeWhile (/=[0,0]) . map (map (read :: String -> Int)) . map words . lines $ s

rect :: [Int] -> String
rect [h,w] =
  concat . take h . repeat  $ ((concat . take w . repeat $ "#" )++"\n")

join'::String -> [String] -> String
join' _ [] = ""
join' j (x:xs) = aux j x xs
  where
    aux :: String -> String -> [String] -> String
    aux j y [] = y
    aux j y (x:xs) = aux j (y++j++x) xs