R=range

l=[[[0 for i in R(10)]for j in R(3)]for s in R(4)]

for i in R(int(eval(input()))):b,f,r,v=list(map(int,input().split()));l[b-1][f-1][r-1]+=v

for i in R(4):

 for k in l[i]:print(("",*k))

 if i!=3:print(("#"*20))
R=range

I=input

p=print

l=[[[0 for i in R(10)]for j in R(3)]for s in R(4)]

for i in R(int(I())):b,f,r,v=map(int,I().split());l[b-1][f-1][r-1]+=v

for i in R(4):

 for k in l[i]:p("",*k)

 if i!=3:p("#"*20)

R = range
l = [[[0 for i in R(10)] for j in R(3)] for s in R(4)]
for i in R(int(eval(input()))):
    b, f, r, v = list(map(int, input().split()))
    l[b - 1][f - 1][r - 1] += v
for i in R(4):
    for k in l[i]:
        print(("", *k))
    if i != 3:
        print(("#" * 20))

R = range
I = input
p = print
l = [[[0 for i in R(10)] for j in R(3)] for s in R(4)]
for i in R(int(I())):
    b, f, r, v = map(int, I().split())
    l[b - 1][f - 1][r - 1] += v
for i in R(4):
    for k in l[i]:
        p("", *k)
    if i != 3:
        p("#" * 20)

+I = input +p = print -for i in R(int(eval(input()))): -    b, f, r, v = list(map(int, input().split())) +for i in R(int(I())): +    b, f, r, v = map(int, I().split()) -        print(("", *k)) +        p("", *k) -        print(("#" * 20)) +        p("#" * 20)