main = readAndDo

readAndDo = do
  line <- getLine
  if line == "0 0" then return ()
  else do
    let [a, b] = input line
    solve [a, b, a]
    putStrLn ""
    readAndDo

-- 入力
input :: String -> [Int]
input = (map read) . words

-- 解答
solve [0, b, c] = return ()
solve [a, 1, c] = do
  putStrLn "#"
  solve [a-1, 1, c]
solve [a, b, c]
  | a == 1 || a == c = do
    putStrLn $ foldr (++) "" $ replicate b "#"
    solve [a-1, b, c]
  | otherwise = do
    putStrLn $ "#" ++ (foldr (++) "" $ replicate (b-2) ".") ++ "#"
    solve [a-1, b, c]

