# define
first = [[0 for i in range(10)] for j in range(3)]
second = [[0 for i in range(10)] for j in range(3)]
third = [[0 for i in range(10)] for j in range(3)]
forth = [[0 for i in range(10)] for j in range(3)]
# input
n = int(input())
datanum=n
info=[]
while n>0:
info.append(list(map(int,input().split())))
n -=1
def roomdata(x,f,r,v):
x[f-1][r-1]+=v
for i in range(datanum):
b=info[i][0]
f=info[i][1]
r=info[i][2]
v=info[i][3]
if b==1:
roomdata(first,f,r,v)
elif b==2:
roomdata(second,f,r,v)
elif b==3:
roomdata(third,f,r,v)
elif b==4:
roomdata(forth,f,r,v)
# output
for i in range(3):
print(" " + " ".join(map(str,first[i])))
print("#"*20)
for i in range(3):
print(" " + " ".join(map(str,second[i])))
print("#"*20)
for i in range(3):
print(" " + " ".join(map(str,third[i])))
print("#"*20)
for i in range(3):
print(" " + " ".join(map(str,forth[i])))