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

l = [eval(input()) for _ in range(h)]

l.insert(0,'#'*(w+2))

l.append('#'*(w+2))



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

    x = list(l.pop(i))

    x.insert(0,'#')

    x.append('#')

    l.insert(i,''.join(x))



for j in range(h+2):

    print((l[j]))

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

l = [eval(input()) for _ in range(h)]

l.insert(0,'#'*(w+2))

l.append('#'*(w+2))



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

    l[i] = '#' +l[i] + '#'



for j in range(h+2):

    print((l[j]))

h, w = list(map(int, input().split()))
l = [eval(input()) for _ in range(h)]
l.insert(0, "#" * (w + 2))
l.append("#" * (w + 2))
for i in range(1, h + 1):
    x = list(l.pop(i))
    x.insert(0, "#")
    x.append("#")
    l.insert(i, "".join(x))
for j in range(h + 2):
    print((l[j]))

h, w = list(map(int, input().split()))
l = [eval(input()) for _ in range(h)]
l.insert(0, "#" * (w + 2))
l.append("#" * (w + 2))
for i in range(1, h + 1):
    l[i] = "#" + l[i] + "#"
for j in range(h + 2):
    print((l[j]))

-    x = list(l.pop(i)) -    x.insert(0, "#") -    x.append("#") -    l.insert(i, "".join(x)) +    l[i] = "#" + l[i] + "#"