ans' :: Int -> Int -> [String]
ans' 0 _ = []
ans' 1 y = [ replicate y '#' ]
ans' x y = ( ( ('#':replicate (y-2) '.') ++ "#"):ans' (x-1) y )

ans :: [Int] -> [String]
ans (x:y:xs) = 
  (replicate y '#' : ans' (x-1) y )

printRec :: [[String]] -> IO()
printRec [] = return ()
printRec (s:sx) = do
  mapM_ putStrLn s
  putStrLn ""
  printRec sx

main = do
  c <- getContents
  let t = map (map read) $ map words $ lines c :: [[Int]]
      i = takeWhile (/= [0,0]) t
      o = map ans i
  printRec o