b_ifo = [[[0 for i in range(10)] for j in range(3)] for k in range(4)]

n = int(input())

for i in range(n):

    b, f, r, v = map(int, input().split())

    b_ifo[b-1][f-1][r-1] += v

for i in range(4):

    for j in range(3):

        for k in range(10):

            print(" " + str(b_ifo[i][j][k]), end = "")

        print()

    if i != 3:

        print("#" * 20)

house = [[[0 for i in range(10)] for j in range(3)] for k in range(4)]

n = int(input())

for i in range(n):

    b, f, r, v = map(int, input().split())

    house[b-1][f-1][r-1] += v

for i in range(4):

    for j in range(3):

        for k in range(10):

            print(" " + str(house[i][j][k]), end="")

        print()

    if j == 3 - 1 and i != 4 - 1:

        print("#" * 20)

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

house = [[[0 for i in range(10)] for j in range(3)] for k in range(4)]
n = int(input())
for i in range(n):
    b, f, r, v = map(int, input().split())
    house[b - 1][f - 1][r - 1] += v
for i in range(4):
    for j in range(3):
        for k in range(10):
            print(" " + str(house[i][j][k]), end="")
        print()
    if j == 3 - 1 and i != 4 - 1:
        print("#" * 20)

-b_ifo = [[[0 for i in range(10)] for j in range(3)] for k in range(4)] +house = [[[0 for i in range(10)] for j in range(3)] for k in range(4)] -    b_ifo[b - 1][f - 1][r - 1] += v +    house[b - 1][f - 1][r - 1] += v -            print(" " + str(b_ifo[i][j][k]), end="") +            print(" " + str(house[i][j][k]), end="") -    if i != 3: +    if j == 3 - 1 and i != 4 - 1: