h,w = map(int,input().split())

A = [list(input()) for i in range(h)]

B = [['']*(w+2)]*(h+2)

for i in range(h+2):

    for j in range(w+2):

        if i==0 or i==h+1:

            B[i][j]='#'

        elif j == 0 or j == w+1:

            B[i][j]='#'

        else:

            B[i][j]=A[i-1][j-1]

    print(*B[i],sep='')

h,w=map(int,input().split())

ans=[['' for i in range(w+2)] for j in range(h+2)]

ans[0] = ['#' for i in range(w+2)]

ans[-1] = ['#' for i in range(w+2)]

for i in range(h):

  ans[i+1][1:w+1] = list(input())

  ans[i+1][0] = '#'

  ans[i+1][-1] = '#'

for i in range(h+2):

  print(*ans[i],sep='')

h, w = map(int, input().split())
A = [list(input()) for i in range(h)]
B = [[""] * (w + 2)] * (h + 2)
for i in range(h + 2):
    for j in range(w + 2):
        if i == 0 or i == h + 1:
            B[i][j] = "#"
        elif j == 0 or j == w + 1:
            B[i][j] = "#"
        else:
            B[i][j] = A[i - 1][j - 1]
    print(*B[i], sep="")

h, w = map(int, input().split())
ans = [["" for i in range(w + 2)] for j in range(h + 2)]
ans[0] = ["#" for i in range(w + 2)]
ans[-1] = ["#" for i in range(w + 2)]
for i in range(h):
    ans[i + 1][1 : w + 1] = list(input())
    ans[i + 1][0] = "#"
    ans[i + 1][-1] = "#"
for i in range(h + 2):
    print(*ans[i], sep="")

-A = [list(input()) for i in range(h)] -B = [[""] * (w + 2)] * (h + 2) +ans = [["" for i in range(w + 2)] for j in range(h + 2)] +ans[0] = ["#" for i in range(w + 2)] +ans[-1] = ["#" for i in range(w + 2)] +for i in range(h): +    ans[i + 1][1 : w + 1] = list(input()) +    ans[i + 1][0] = "#" +    ans[i + 1][-1] = "#" -    for j in range(w + 2): -        if i == 0 or i == h + 1: -            B[i][j] = "#" -        elif j == 0 or j == w + 1: -            B[i][j] = "#" -        else: -            B[i][j] = A[i - 1][j - 1] -    print(*B[i], sep="") +    print(*ans[i], sep="")