# coding: utf-8

def make_buildings():

    return [[[0 for room in range(10)] for floor in range(3)] for building in range(4)]



def print_building(building):

    return "\n".join([" " + " ".join(map(str, floor)) for floor in building])

    

line_number = int(eval(input()))

regidents_data = [list(map(int, input().split(" "))) for i in range(line_number)]

buildings = make_buildings()



for data in regidents_data:

    b, f, r, v = data

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



print(("\n####################\n".join(map(print_building, buildings))))
# coding: utf-8

def format_building(building):

    return "\n".join([" " + " ".join(map(str, floor)) for floor in building])

    

line_number = int(eval(input()))

regidents_data = [list(map(int, input().split(" "))) for i in range(line_number)]

buildings = [[[0 for room in range(10)] for floor in range(3)] for building in range(4)]



for data in regidents_data:

    b, f, r, v = data

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



print(("\n####################\n".join(map(format_building, buildings))))
# coding: utf-8
def make_buildings():
    return [[[0 for room in range(10)] for floor in range(3)] for building in range(4)]


def print_building(building):
    return "\n".join([" " + " ".join(map(str, floor)) for floor in building])


line_number = int(eval(input()))
regidents_data = [list(map(int, input().split(" "))) for i in range(line_number)]
buildings = make_buildings()
for data in regidents_data:
    b, f, r, v = data
    buildings[b - 1][f - 1][r - 1] += v
print(("\n####################\n".join(map(print_building, buildings))))

# coding: utf-8
def format_building(building):
    return "\n".join([" " + " ".join(map(str, floor)) for floor in building])


line_number = int(eval(input()))
regidents_data = [list(map(int, input().split(" "))) for i in range(line_number)]
buildings = [[[0 for room in range(10)] for floor in range(3)] for building in range(4)]
for data in regidents_data:
    b, f, r, v = data
    buildings[b - 1][f - 1][r - 1] += v
print(("\n####################\n".join(map(format_building, buildings))))

-def make_buildings(): -    return [[[0 for room in range(10)] for floor in range(3)] for building in range(4)] - - -def print_building(building): +def format_building(building): -buildings = make_buildings() +buildings = [[[0 for room in range(10)] for floor in range(3)] for building in range(4)] -print(("\n####################\n".join(map(print_building, buildings)))) +print(("\n####################\n".join(map(format_building, buildings))))