arr=list(map(int,input().rstrip().split()))

r=arr[0]

c=arr[1]

line=[]

for i in range(0,r):

    line.append(input())

s=[[0 for x in range(r)]for y in range(c)]

for i in range(0,r+2):

    for j in range(0,c+2):

        if i == 0 or i == r + 1 or j == 0 or j == c + 1:

            print("#",end="")

        else:

            z=line[i-1]

            print(z[j-1],end="")

    print()



h,w = [int(i) for i in input().split()]



pic = []



for i in range(h):

	pic.append(input())





for i in range(w+2):

	print('#', sep='',end='')

print()



for i in range(h):

	print('#', sep='',end='')

	print(pic[i],end='')

	print('#')





for i in range(w+2):

	print('#', sep='',end='')

print()

arr = list(map(int, input().rstrip().split()))
r = arr[0]
c = arr[1]
line = []
for i in range(0, r):
    line.append(input())
s = [[0 for x in range(r)] for y in range(c)]
for i in range(0, r + 2):
    for j in range(0, c + 2):
        if i == 0 or i == r + 1 or j == 0 or j == c + 1:
            print("#", end="")
        else:
            z = line[i - 1]
            print(z[j - 1], end="")
    print()

h, w = [int(i) for i in input().split()]
pic = []
for i in range(h):
    pic.append(input())
for i in range(w + 2):
    print("#", sep="", end="")
print()
for i in range(h):
    print("#", sep="", end="")
    print(pic[i], end="")
    print("#")
for i in range(w + 2):
    print("#", sep="", end="")
print()

-arr = list(map(int, input().rstrip().split())) -r = arr[0] -c = arr[1] -line = [] -for i in range(0, r): -    line.append(input()) -s = [[0 for x in range(r)] for y in range(c)] -for i in range(0, r + 2): -    for j in range(0, c + 2): -        if i == 0 or i == r + 1 or j == 0 or j == c + 1: -            print("#", end="") -        else: -            z = line[i - 1] -            print(z[j - 1], end="") -    print() +h, w = [int(i) for i in input().split()] +pic = [] +for i in range(h): +    pic.append(input()) +for i in range(w + 2): +    print("#", sep="", end="") +print() +for i in range(h): +    print("#", sep="", end="") +    print(pic[i], end="") +    print("#") +for i in range(w + 2): +    print("#", sep="", end="") +print()