import Data.Functor ((<$>))

main :: IO ()
main = do
  [h, w] <- map (read :: String -> Int) . words <$> getLine
  if h == 0 && w == 0
    then return ()
    else do
      putStrLn . unlines $ do
        i <- [1..h]
        return $ do
          j <- [1..w]
          if i >= 2 && i <= h-1 && j >= 2 && j <= w-1
            then return '.'
            else return '#'
      main

