import Control.Applicative
import Control.Monad

rInt s = read s :: Int

main  = do
	ss <- (map (map rInt) . map words . lines) <$> getContents
	mapM (mapM putStrLn . rect) $ takeWhile (\(h:(w:_)) -> h/=0 && w/=0) ss 
		where rect (h:(w:_)) = replicate h (replicate w '#') ++ [""]