main = getContents >>= putOut.formatOut.map calc.formatIn
  where putOut s | last s == '\n' = putStr s
                 | otherwise      = putStrLn s

formatIn :: String -> [[Int]]
formatIn = map ((map (read :: String -> Int)).words).takeWhile (/="0 0").lines

formatOut :: [String] -> String
formatOut = unlines

calc :: [Int] -> String
calc (h:w:_) = unlines $replicate h (replicate w '#')