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