H,W=list(map(int, input().split()))

A=[eval(input()) for _ in range(H)]

print(('#'*(W+2)))

for a in A:

    print(('#' + a + '#'))

print(('#'*(W+2)))

H,W=list(map(int, input().split()))

ans=[['#']*(W+2) for _ in range(H+2)]

for i in range(1,H+1):

    for j,a in enumerate(eval(input())):

        j+=1

        ans[i][j]=a

for a in ans:

    print((''.join(a)))
H, W = list(map(int, input().split()))
A = [eval(input()) for _ in range(H)]
print(("#" * (W + 2)))
for a in A:
    print(("#" + a + "#"))
print(("#" * (W + 2)))

H, W = list(map(int, input().split()))
ans = [["#"] * (W + 2) for _ in range(H + 2)]
for i in range(1, H + 1):
    for j, a in enumerate(eval(input())):
        j += 1
        ans[i][j] = a
for a in ans:
    print(("".join(a)))

-A = [eval(input()) for _ in range(H)] -print(("#" * (W + 2))) -for a in A: -    print(("#" + a + "#")) -print(("#" * (W + 2))) +ans = [["#"] * (W + 2) for _ in range(H + 2)] +for i in range(1, H + 1): +    for j, a in enumerate(eval(input())): +        j += 1 +        ans[i][j] = a +for a in ans: +    print(("".join(a)))