makeShape :: Int -> a -> a -> [a]
makeShape n a b = a : f' (n - 1)
  where f' x = if x > 1 then b : f' (x - 1) else [a]

makeFrame :: Int -> Int -> [String]
makeFrame h w = makeShape h hl ml
  where
    hl = replicate w '#'
    ml = makeShape w '#' '.'

main = do
  contents <- getContents
  let
    dat = takeWhile (/= [0,0]) 
      $ map (map (read :: String -> Int)) 
      $ map words 
      $ lines contents
    ansList = map (\[h,w] -> makeFrame h w) dat
  mapM_ (putStrLn . unlines) ansList
