import sys

write=sys.stdout.write



buildings=[[[],[],[]],[[],[],[]],[[],[],[]],[[],[],[]]]

for i in range(0,4):

    for j in range(0,3):

        for k in range(0,10):

            buildings[i][j].append(0)



informations=int(eval(input()))



for i in range(0,informations):

    information=[]

    information=input().split()

    information[0]=int(information[0])

    information[1]=int(information[1])

    information[2]=int(information[2])

    information[3]=int(information[3])

    buildings[information[0]-1][information[1]-1][information[2]-1]+=information[3]



for i in range(0,4):

    for j in range(0,3):

        for k in range(0,10):

            write(' ')

            write(str(buildings[i][j][k]))

        print()

    if i !=3:

        for j in range(0,20):

            write('#')

        print()
buildings=[[[0 for i in range(10)]for m in range(3)]for k in range(4)]

x=int(input())

for i in range(x):

    a,b,c,d=map(int,input().split())

    buildings[a-1][b-1][c-1]+=d

for i in range(4):

    for j in range(3):

        for k in range(10):

            print("",buildings[i][j][k],end="")

        print()

    if i!=3:

        print("#"*20)

import sys

write = sys.stdout.write
buildings = [[[], [], []], [[], [], []], [[], [], []], [[], [], []]]
for i in range(0, 4):
    for j in range(0, 3):
        for k in range(0, 10):
            buildings[i][j].append(0)
informations = int(eval(input()))
for i in range(0, informations):
    information = []
    information = input().split()
    information[0] = int(information[0])
    information[1] = int(information[1])
    information[2] = int(information[2])
    information[3] = int(information[3])
    buildings[information[0] - 1][information[1] - 1][
        information[2] - 1
    ] += information[3]
for i in range(0, 4):
    for j in range(0, 3):
        for k in range(0, 10):
            write(" ")
            write(str(buildings[i][j][k]))
        print()
    if i != 3:
        for j in range(0, 20):
            write("#")
        print()

buildings = [[[0 for i in range(10)] for m in range(3)] for k in range(4)]
x = int(input())
for i in range(x):
    a, b, c, d = map(int, input().split())
    buildings[a - 1][b - 1][c - 1] += d
for i in range(4):
    for j in range(3):
        for k in range(10):
            print("", buildings[i][j][k], end="")
        print()
    if i != 3:
        print("#" * 20)

-import sys - -write = sys.stdout.write -buildings = [[[], [], []], [[], [], []], [[], [], []], [[], [], []]] -for i in range(0, 4): -    for j in range(0, 3): -        for k in range(0, 10): -            buildings[i][j].append(0) -informations = int(eval(input())) -for i in range(0, informations): -    information = [] -    information = input().split() -    information[0] = int(information[0]) -    information[1] = int(information[1]) -    information[2] = int(information[2]) -    information[3] = int(information[3]) -    buildings[information[0] - 1][information[1] - 1][ -        information[2] - 1 -    ] += information[3] -for i in range(0, 4): -    for j in range(0, 3): -        for k in range(0, 10): -            write(" ") -            write(str(buildings[i][j][k])) +buildings = [[[0 for i in range(10)] for m in range(3)] for k in range(4)] +x = int(input()) +for i in range(x): +    a, b, c, d = map(int, input().split()) +    buildings[a - 1][b - 1][c - 1] += d +for i in range(4): +    for j in range(3): +        for k in range(10): +            print("", buildings[i][j][k], end="") -        for j in range(0, 20): -            write("#") -        print() +        print("#" * 20)