Problem:
Official House You manage 4 buildings, each of which has 3 floors, each of which consists of 10 rooms. Write a program which reads a sequence of tenant/leaver notices, and reports the number of tenants for each room. For each notice, you are given four integers b , f , r and v which represent that v persons entered to room r of f th floor at building b . If v is negative, it means that −v persons left. Assume that initially no person lives in the building. Input In the first line, the number of notices n is given. In the following n lines, a set of four integers b , f , r and v which represents i th notice is given in a line. Output For each building, print the information of 1st, 2nd and 3rd floor in this order. For each floor information, print the number of tenants of 1st, 2nd, .. and 10th room in this order. Print a single space character before the number of tenants. Print "####################" (20 '#') between buildings. Constraints  No incorrect building, floor and room numbers are given.  0 ≤ the number of tenants during the management ≤ 9  Sample Input 3
1 1 3 8
3 2 2 7
4 3 8 1 Sample Output 0 0 8 0 0 0 0 0 0 0
 0 0 0 0 0 0 0 0 0 0
 0 0 0 0 0 0 0 0 0 0
####################
 0 0 0 0 0 0 0 0 0 0
 0 0 0 0 0 0 0 0 0 0
 0 0 0 0 0 0 0 0 0 0
####################
 0 0 0 0 0 0 0 0 0 0
 0 7 0 0 0 0 0 0 0 0
 0 0 0 0 0 0 0 0 0 0
####################
 0 0 0 0 0 0 0 0 0 0
 0 0 0 0 0 0 0 0 0 0
 0 0 0 0 0 0 0 1 0 0

Solution (Python):
n=int(input())
information=[]

one=[[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0]]
two=[[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0]]
three=[[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0]]
four=[[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0]]
kousya=[one,two,three,four]

for i in range(n):
    information=list(map(int,input().split()))
    b=information[0]-1
    f=information[1]-1
    r=information[2]-1
    v=information[3]
    kousya[b][f][r]=kousya[b][f][r]+v
    information=[]

for i in range(4):
    for j in range(3):
        for k in range(10):
            if k<9:
                print(" "+str(kousya[i][j][k]),end="")
            else:
                print(" "+str(kousya[i][j][k]))
    if i<3:
        print("

Solution (Python):

n =  int(input())


tatemono = [0] * 4 * 3 *10
while ( n > 0 ):
    (b,f,r,v)  =  map(int,input().split())
    tatemono[(b-1)*30 + (f-1)*10 + r-1] += v
    n = n -1


for  i in range (0,4):
    for  i2 in range (0,3):
        for  i3 in range (0,10):
            print (' {}'.format(tatemono[i3 + i*30 + i2*10]),end="")
        else:
            print("")
    if ( i != 3 ):
        print ("

Solution (Python):
n=int(input())
d={}
for i in range(4):
    for j in range(3):
        d[(i+1,j+1)]=[0,0,0,0,0,0,0,0,0,0]
for i in range(n):
    b, f, r, v = map(int,input().split())
    d[(b,f)][r-1]+=v
for i in range(4):
    for j in range(3):
        print(" "+" ".join(map(str,d[i+1,j+1])))
    if i <3:
        print("

Solution (Python):
list = [[[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())
    list[b-1][f-1][r-1] += v

for k in range(4):
    for j in range(3):
        for i in range(10):
            print ("", end=" ")
            print (list[k][j][i], end = "")
        print("")
    if k != 3:
        print("

Solution (Python):
n = int(input())

blist = []
flist = []
rlist = []
vlist = []

for _ in range(n):
    b, f, r, v = map(int, input().split())
    blist.append(b)
    flist.append(f)
    rlist.append(r)
    vlist.append(v)

arr4 = [[[0 for i3 in range(10)] for i2 in range(3)] for i1 in range(4)]

for b, f, r, v in zip(blist, flist, rlist, vlist):
    arr4[b-1][f-1][r-1] += v

for b in range(3):
    for f in range(3):
        for r in range(10):
            print(" " + str(arr4[b][f][r]), end="")
        print()
    print("

for f in range(3):
    for r in range(10):
        print(" " + str(arr4[3][f][r]), end="")
    print()

Solution (Python):
answer = [[[0]*10 for i in range(3)] for k in range(4)]
N = int(input())
for i in range(N):
    b, f, r, v = map(int, input().split())
    answer[b-1][f-1][r-1] += v
    
for i in range(3):
    for k in range(3):
        for l in range(10):
            print(" " + str(answer[i][k][l]),end="")
        print()
    print("
for k in range(3):
    for l in range(10):
        print(" " + str(answer[3][k][l]),end="")
    print()

Solution (Python):
def custom_print(building):
    for i in range(3):
        print(' ' + ' '.join([str(o) for o in building[i]]))


SEPARATOR = "

if __name__ == '__main__':

    n = int(input())

    building_1 = [
        [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
        [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
        [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
    ]
    building_2 = [
        [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
        [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
        [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
    ]
    building_3 = [
        [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
        [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
        [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
    ]
    building_4 = [
        [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
        [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
        [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
    ]

    for i in range(n):
        input_line = input().split()
        b = int(input_line[0])
        f = int(input_line[1])
        r = int(input_line[2])
        v = int(input_line[3])

        if b == 1:
            building_1[f - 1][r - 1] += v
        elif b == 2:
            building_2[f - 1][r - 1] += v
        elif b == 3:
            building_3[f - 1][r - 1] += v
        else:
            building_4[f - 1][r - 1] += v

    custom_print(building_1)
    print(SEPARATOR)
    custom_print(building_2)
    print(SEPARATOR)
    custom_print(building_3)
    print(SEPARATOR)
    custom_print(building_4)

Solution (Python):
n = input()
n = int(n)

BUILDS = 4
FLOORS = 3
ROOMS = 10

house = [[[0 for x in range(ROOMS)] for y in range(FLOORS)] for z in range(BUILDS)]

for i in range(n):
    a = input()
    b, f, r, v = a.split(' ')
    house[int(b) - 1][int(f) - 1][int(r) - 1] += int(v)

for i in range(BUILDS):
    for j in range(FLOORS):
        floor = ''
        for k in range(ROOMS):
            floor += ' {}'.format(house[i][j][k])
        print(floor)
    
    if i < BUILDS - 1:
        print('

Solution (Python):
def print_building(b_dict,b_floor):
    for i in range(len(b_dict[b_floor])):
        for j in b_dict[b_floor][i]:
            print(' {}'.format(j),end='')
        print('\r')

def print_fence():
    print('

building = {
    1:[[0]*10 for i in range(3)],
    2:[[0]*10 for i in range(3)],
    3:[[0]*10 for i in range(3)],
    4:[[0]*10 for i in range(3)]
}

n = int(input())
for _ in range(n):
    b,f,r,v = map(int,input().split())
    building[b][f-1][r-1] += v

for i in range(1,4):
    print_building(building,i)
    print_fence()
print_building(building,4)

Solution (Python):
n = int(input())
R,F,B = 10,3,4

Status = [[[0 for x in range(R)] for y in range(F)] for z in range(B)]

for i in range(n):
    (b,f,r,v) = map(int,input().split())
    Status[b-1][f-1][r-1]+=v

for m in range(4):
    for n in range(3):
        for k in range(10):
            print(" {}".format(Status[m][n][k]),end="")
        print()
    if m+1 in range(4):
        print("

Solution (Python):
building=[[[0]*10 for i in range(0,3)] for i in range(0,4)]
n=int(input())
for i in range(0,n):
    b,f,r,v=map(int,input().split())
    building[b-1][f-1][r-1]+=v
for i in range(0,4):
    for j in range(0,3):
        for k in range(0,10):
            print(f" {building[i][j][k]}",end="")
        print()
    if(i!=3):
        print("{}".format("

Solution (Python):
L = [[[0 for i in range(10)] for i in range(3) ] for i in range(4)]
n = int(input())
for i in range(n):
    b, f, r, v = map(int, input().split())
    L[b-1][f-1][r-1] += v
for bn, b in enumerate(L):
    for f in b:
        print(" ", end="")
        print(*f)
    if not bn == 3:
        print("

Solution (Python):
h = [[[0 for _ in range(10)] for _ in range(3)] for _ in range(4)]

for _ in range(int(input())):
    b, f, r, v = map(int, input().split())
    h[b-1][f-1][r-1] += v

for b in range(4):
    for f in range(3):
        print(' ' + ' '.join(map(str,h[b][f])))
    if b<3:
        print('

Solution (Python):
A=[[0 for ia in range(10)]for iaa in range(3)]
B=[[0 for ib in range(10)]for ibb in range(3)]
C=[[0 for ic in range(10)]for icc in range(3)]
D=[[0 for id in range(10)]for idd in range(3)]
num=int(input())
for i in range(num):
	a=input().split()
	if int(a[0])==1:
		A[int(a[1])-1][int(a[2])-1]+=int(a[3])
	elif int(a[0])==2:
		B[int(a[1])-1][int(a[2])-1]+=int(a[3])
	elif int(a[0])==3:
		C[int(a[1])-1][int(a[2])-1]+=int(a[3])
	elif int(a[0])==4:
		D[int(a[1])-1][int(a[2])-1]+=int(a[3])
	else:
		pass
for ja in range(3):
	for ka in range(10):
		print(' ',end='')
		print((A[ja][ka]),end='')
	print() 
print('
for jb in range(3):
	for kb in range(10):
		print(' ',end='')
		print((B[jb][kb]),end='')
	print()
print('
for jc in range(3):
	for kc in range(10):
		print(' ',end='')
		print((C[jc][kc]),end='')
	print()
print('
for jd in range(3):
	for kd in range(10):
		print(' ',end='')
		print((D[jd][kd]),end='')
	print()

Solution (Python):
n_room = 10     
n_floor = 3     
n_blds = 4      
cnt1 = 0           
ary = []        


ary = [[[0]*n_room for i in range (0,n_floor)] for k in range (0,n_blds)]

n = int(input())    
cnt2 = 0            

while True:
    b,f,r,v = map(int, input().split())
    ary[b-1][f-1][r-1] += v
    cnt2 += 1
    if cnt2 == n:
        break
    
x = 0

for i in range(4):
    if x != 0:
        print("
    x += 1

    for a in range(3):
        for b in range(10):
            print(" %d"%(ary[i][a][b]),end = "")
        print()

Solution (Python):

result = []

for b in range(0, 4):
    result.append([])
    for f in range(0, 3):
        result[b].append([])
        for r in range(0, 10):
            result[b][f].append(0)

n = int(input())
for i in range(0, n):
    b, f, r, v = input().split()
    result[int(b) - 1][int(f) - 1][int(r) - 1] += int(v)

for b in range(0, 4):
    for f in range(0, 3):
        for r in range(0, 10):
            print(' '+ str(result[b][f][r]), end = '')
        print()
    if (b < 3):
        for m in range(0, 20):
            print('
        print()

Solution (Python):
data = [[[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())
    data[b-1][f-1][r-1] += v

for bild in range(4):
    for floor in range(3):
        ans = " ".join(map(str, data[bild][floor]))
        print(" "+ans)
    if bild != 3:
        print("

Solution (Python):





N=int(input())
buildings= list()
floor= list()
result=""
for j in range(4):
    floor= list()
    for i in range(3):
        floor.insert(i,list("0"*10))
    buildings.insert(j,floor)


for _ in range(N):
    b,f,r,v=map(int,input().split())
    buildings[b-1][f-1][r-1]=int(buildings[b-1][f-1][r-1])+v

for i,building in enumerate(buildings):
    
    for floor in building:
        result=" "+" ".join(map(str,floor))
        print(result)
    if(i==len(buildings)-1):
        break
    print("

Solution (Python):
n=int(input())
a=[[ [0 for i in range(10)] for j in range(3) ] for k in range(4)]
for i in range(n):
	b,f,r,v=map(int,input().split())
	a[b-1][f-1][r-1]+=v

for i in range(4):
	for j in range(4):
		for k in range(10):
			if j==3:
				if i<3:
					print("
				else:
					break
			else:
				print(" "+str(a[i][j][k]),end="")
			if k==9:
				print("")

Solution (Python):


room = [[[0]*10 for i in range(3)] for k in range(4)]
n =  int(input().strip())

for m in range(n):
    raw_data = input()
    data = list(map(int,raw_data.split()))
    room[data[0]-1][data[1]-1][data[2]-1]+=data[3]

for build in range(3):
    for floor in range(3):
        data = " "+str(room[build][floor][0])
        for No in range(1,10):
            data = data+" "+str(room[build][floor][No])
        print(data)
    print('
for floor in range(3):
    data = " "+str(room[3][floor][0])
    for No in range(1,10):
        data = data+" "+str(room[3][floor][No])
    print(data)

Solution (Python):
import sys

ans = [[[0 for _ in range(10)] for _ in range(3)] for _ in range(4)]

lst = []

N = int(input())
for i in sys.stdin.readlines():
    row = i.rstrip().split()
    b = int(row[0])
    f = int(row[1])
    r = int(row[2])
    v = int(row[3])
    
    ans[b-1][f-1][r-1] += v
    
for i,j in enumerate(ans,start=1):
    if i != 4:
        for k in j:
            print(' ', end='')
            print(*k)
        print('
    else:
        for k in j:
            print(' ', end='')
            print(*k)

Solution (Python):
building = [[[0 for _ in range(10)] for _ in range(3)] for _ in range(4)]
n = int(input())

for _ in range(n):
    b, f, r, v = map(int, input().split())
    building[b-1][f-1][r-1] += v

for i in range(4):
    for j in range(3):
        print(' ' + ' '.join(map(str, building[i][j])))
    if i != 3:
        print('

Solution (Python):
count = [[[0 for i in range(10)] for j in range(3)] for k in range(4)]

n = int(input())

for cnt in range(n):
    b, f, r, v = [int(x) for x in input().split()]
    count[b-1][f-1][r-1] += v

for i, b in enumerate(count):
    for f in b:
        for r in f:
            print(" {0}".format(r), end = "")
        print()
    if i < 3: print("

Solution (Python):
n = int(input())
i = 1

listA = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
listB = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
listC = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
listD = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
listE = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
listF = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
listG = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
listH = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
listI = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
listJ = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
listK = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
listL = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]

while i < n+1:
    b, f, r, v = map(int, input().split())
    if 3 * b + f == 4:
        listA[r-1] += v
        i += 1
    
    elif 3 * b + f == 5:
        listB[r-1] += v
        i += 1
    
    elif 3 * b + f == 6:
        listC[r-1] += v
        i += 1
    
    elif 3 * b + f == 7:
        listD[r-1] += v
        i += 1
    
    elif 3 * b + f == 8:
        listE[r-1] += v
        i += 1
    
    elif 3 * b + f == 9:
        listF[r-1] += v
        i += 1
    
    elif 3 * b + f == 10:
        listG[r-1] += v
        i += 1
    
    elif 3 * b + f == 11:
        listH[r-1] += v
        i += 1
    
    elif 3 * b + f == 12:
        listI[r-1] += v
        i += 1
    
    elif 3 * b + f == 13:
        listJ[r-1] += v
        i += 1
    
    elif 3 * b + f == 14:
        listK[r-1] += v
        i += 1
    
    else:
        listL[r-1] += v
        i += 1
    
    
for i in range(9):
    print(' ' + str(listA[i]), end='')
print(' ' + str(listA[9]), end='\n')
for i in range(9):
    print(' ' + str(listB[i]), end='')
print(' ' + str(listB[9]), end='\n')
for i in range(9):
    print(' ' + str(listC[i]), end='')
print(' ' + str(listC[9]), end='\n')
print('
for i in range(9):
    print(' ' + str(listD[i]), end='')
print(' ' + str(listD[9]), end='\n')
for i in range(9):
    print(' ' + str(listE[i]), end='')
print(' ' + str(listE[9]), end='\n')
for i in range(9):
    print(' ' + str(listF[i]), end='')
print(' ' + str(listF[9]), end='\n')
print('
for i in range(9):
    print(' ' + str(listG[i]), end='')
print(' ' + str(listG[9]), end='\n')
for i in range(9):
    print(' ' + str(listH[i]), end='')
print(' ' + str(listH[9]), end='\n')
for i in range(9):
    print(' ' + str(listI[i]), end='')
print(' ' + str(listI[9]), end='\n')
print('
for i in range(9):
    print(' ' + str(listJ[i]), end='')
print(' ' + str(listJ[9]), end='\n')
for i in range(9):
    print(' ' + str(listK[i]), end='')
print(' ' + str(listK[9]), end='\n')
for i in range(9):
    print(' ' + str(listL[i]), end='')
print(' ' + str(listL[9]), end='\n')

Solution (Python):
BIG_NUM = 2000000000

table = [[[0]*10 for i in range (0,3)] for k in range (0,4)]

N = int(input())

for loop in range(N):
    house_id,floor,room,add = map(int,input().split())
    table[house_id-1][floor-1][room-1] += add


x = 0

for i in range(4):
    if x != 0:
        print("
    x += 1

    for a in range(3):
        for b in range(10):
            print(" %d"%(table[i][a][b]),end = "")
        print()

Solution (Python):
x = [[[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())
    x[b-1][f-1][r-1] += v
for i in range(4):
    for j in range(3):
        for k in range(10):
            print(" ", end="")
            print(x[i][j][k], end="")
        print()
    if i < 3:
        print("

Solution (Python):
count = [[[0 for r in range(10)] for f in range(3)] for b in range(4)]

n = int(input())
for i in range(n):
    b, f, r, v = map(int, input().split())
    count[b-1][f-1][r-1] += v

for i in range(4):
    if i > 0:
        print("
    for j in range(3):
        for k in range(10):
            print(" " + str(count[i][j][k]), end="")
        print("")

Solution (Python):
B=[
[
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0,],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0,],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0,]
],
[
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0,],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0,],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0,]
],
[
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0,],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0,],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0,]
],
[
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0,],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0,],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0,]
]
]

def f(x):
    for k in range(3):
        word = ""
        for i in range(10):
            if i !=10:
                word = word +" "+str(B[x][k][i])
            else:
                word = word +str(B[x][k][i])
        print(word)


N = int(input())
K = []
for i in range(N):
    b, f, r, v = map(int, input().split())
    B[b-1][f-1][r-1] = B[b-1][f-1][r-1] + v

def f(x):
    for k in range(3):
        word = ""
        for i in range(10):
            if i !=10:
                word = word +" "+str(B[x][k][i])
            else:
                word = word +str(B[x][k][i])
        print(word)

f(0)
print("
f(1)
print("
f(2)
print("
f(3)

Solution (Python):
n = int(input())
w = [0] * 30
x = [0] * 30
y = [0] * 30
z = [0] * 30

for i in range(n):
    b, f, r, v = map(int, input().split())
    if b == 1:
        w[r + (f - 1)*10 - 1] += v
    if b == 2:
        x[r + (f - 1)*10 - 1] += v
    if b == 3:
        y[r + (f - 1)*10 - 1] += v
    if b == 4:
        z[r + (f - 1)*10 - 1] += v


first = ''
second = ''
third = ''

for i in range(10):
    first += ' ' + str(w[i])
print(first)
for i in range(10):
    second += ' ' + str(w[i + 10])
print(second)
for i in range(10):
    third += ' ' + str(w[i + 20])
print(third)
first = ''
second = ''
third = ''

print('

for i in range(10):
    first += ' ' + str(x[i])
print(first)
for i in range(10):
    second += ' ' + str(x[i + 10])
print(second)
for i in range(10):
    third += ' ' + str(x[i + 20])
print(third)
first = ''
second = ''
third = ''

print('

for i in range(10):
    first += ' ' + str(y[i])
print(first)
for i in range(10):
    second += ' ' + str(y[i + 10])
print(second)
for i in range(10):
    third += ' ' + str(y[i + 20])
print(third)
first = ''
second = ''
third = ''

print('

for i in range(10):
    first += ' ' + str(z[i])
print(first)
for i in range(10):
    second += ' ' + str(z[i + 10])
print(second)
for i in range(10):
    third += ' ' + str(z[i + 20])
print(third)

Solution (Python):
import sys
input_lines = sys.stdin.readlines()[1:]

bls = [[[0] * 10 for i in range(3)] for j in range(4)]
for line in input_lines:
    [b,f,r,v] = [int(i) for i in line.split()]
    bls[b-1][f-1][r-1] += v
for i in range(4):
    for f in bls[i]:
        print(''.join([' {0}'.format(v) for v in f]))
    if i<3:
        print('

Solution (Python):
def manageHotel(l, b, f, r, v):
	l[b-1][f-1][r-1] += v
	return l

build = list()
for i in range(4):
	floor = list()
	for j in range(3):
		room = list()
		for k in range(10):
			room.append(0)
		floor.append(room)
	build.append(floor)
i = int(input())
while i > 0:
	data = [int(x) for x in input().split()]
	build = manageHotel(build, data[0], data[1], data[2], data[3])
	i -= 1
for b in range(len(build)):
	for f in range(len(build[b])):
		for r in range(len(build[b][f])):
			print(' %d' % (build[b][f][r]), end='')
		print()
	if b < len(build) - 1:
		print('

Solution (Python):
off = [[[0 for _ in range(10)] for _ in range(3)] for _ in range(4)]
n = int(input())

for _ in range(n):
    b,f,r,v = map(int,input().split())
    off[b-1][f-1][r-1] += v

for i in range(4):
    for j in range(3):
        print(' '+' '.join(map(str,off[i][j])))
    if i != 3:
        print('

Solution (Python):
'import sys'
d=[[[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=[int(j) for j in input().split()]
    d[b-1][f-1][r-1]+=v
for i, b in enumerate(d):
    for f in b:
        for r in f:
            print(" {}".format(r),end="")
        print()
    if i< 3:
        print("

Solution (Python):
n = int(input())
a = [[[0]*10 for _ in range(3)] for _ in range(4)]
for i in range(n):
  b, f, r, v = list(map(int, input().split()))
  a[b-1][f-1][r-1] += v
for i in range(4):
  for j in range(3):
    print(" "+" ".join(map(str, a[i][j])))
  if i!=3:
    print("

Solution (Python):
L = [[[0] * 10 for i in range(3)] for j in range(4)]
n = int(input())
for i in range(n):
  b, f, r, v = list(map(int, input().split()))
  L[b - 1][f - 1][r - 1] += v
for i in range(4):
  for j in range(3):
    for k in range(10):
      print(" {}".format(L[i][j][k]), end = "")
    print()
  if i + 1 != 4:
    print("

Solution (Python):
n1 = [0 for i in range(10) for j in range(3)]
n2 = [0 for i in range(10) for j in range(3)]
n3 = [0 for i in range(10) for j in range(3)]
n4 = [0 for i in range(10) for j in range(3)]
for _ in range(int(input())):
	b,f,r,v = map(int, tuple(input().split(' ')))
	if b == 1:
		n1[10*(f-1)+r-1] += v
	elif b == 2:
		n2[10*(f-1)+r-1] += v
	elif b == 3:
		n3[10*(f-1)+r-1] += v
	elif b == 4:
		n4[10*(f-1)+r-1] += v
for j in range(3): 
	s = ''
	for i in range(10): s += ' ' + str(n1[10*j+i])
	print(s)
print('
for j in range(3): 
	s = ''
	for i in range(10): s += ' ' + str(n2[10*j+i])
	print(s)
print('
for j in range(3): 
	s = ''
	for i in range(10): s += ' ' + str(n3[10*j+i])
	print(s)
print('
for j in range(3): 
	s = ''
	for i in range(10): s += ' ' + str(n4[10*j+i])
	print(s)

Solution (Python):
data = []
for x in range(0,3*10*4):
    data.append(0)
num = int(input())
for x in range(0,num):
    b,f,r,v = map(int, input().split())
    tmp = data.pop(30*(b-1)+10*(f-1)+(r-1))
    data.insert(30*(b-1)+10*(f-1)+(r-1),v+tmp)
for x in range(0,4) :
    for y in range(0,3):
        for z in range(0,10):
            print('',data.pop(0),end='')
        print("")
    if x != 3:
        print("
    else:
        pass