rect :: [String] -> [String]
rect (h:w:_) =  (\(x:y:_) -> replicate x $ replicate y '#') $ [read h, read w] 

main=do
    xs <- fmap (map words . lines) getContents
    mapM putStrLn . map unlines . map rect $ takeWhile (\(h:_:_) -> h/="0") xs
