solve xs =
  let siege = take (length xs) repeat '#'
       lineList = map (\ys -> ['#'] ++ ys ++ ['#']))  lines xs
  in [siege] ++ lineList ++ [siege]

main=do
  n <- read <$> getLine
  xs <- replicateM n getLine
  mapM_ putStrLn $ solve xs
  where
    toInt :: String -> Int
    toInt = read