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):
A1=[["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"]]
A2=[["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"]]
A3=[["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"]]
A4=[["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"]]
N=int(input())
for j in range(N):
    b,f,r,v=map(int,input().split())
    if b==1:
        A1[f-1][r-1]=str(v+int(A1[f-1][r-1]))
    elif b==2:
        A2[f-1][r-1]=str(v+int(A2[f-1][r-1]))
    elif b==3:
        A3[f-1][r-1]=str(v+int(A3[f-1][r-1]))
    else:
        A4[f-1][r-1]=str(v+int(A4[f-1][r-1]))
for i in range(3):
    m=" "+" ".join(A1[i])
    print(m)
print("
for i in range(3):
    m=" "+" ".join(A2[i])
    print(m)
print("
for i in range(3):
    m=" "+" ".join(A3[i])
    print(m)
print("
for i in range(3):
    m=" "+" ".join(A4[i])
    print(m)

Solution (Python):
mansions = [[[0 for x in range(10)] 
                for floor in range(3)] 
                    for i in range(4)]

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

mn_cnt =0
for mansion in mansions:
    for floor in mansion:
        print(" "+" ".join(map(str,floor)))
    if mn_cnt != 3:
        print("
    mn_cnt+=1

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

n = int(input())

for l in range (n):
    a,b,c,d =input().split()
    mansions[int(a)-1][int(b)-1][int(c)-1] += int(d)


for i in range(4):
    if not i == 0:
        print()
        print("
    for j in range(3):
        if not j == 0:
            print()
        for k in range(10):
            print(" ",end="")
            print(mansions[i][j][k],end="")
            if i == 3 and j == 2 and k == 9:
                print()

Solution (Python):
n = int(input())
cube = [[[0 for z in range(10)] for y in range(3)] for x in range(4)]

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

for x in range(4):
    for y in range(3):
        for z in range(10):
            print(' ' + str(cube[x][y][z]), end='')
        print()
    if x < 3: 
        print('

Solution (Python):

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

inp_num = int(input())
for i in range(inp_num):
    building,floor,room,v = list(map(int, input().split()))
    dorm[building - 1][floor - 1][room - 1] += v

for i in range(4):
    for j in range(3):
        for k in range(10):
            print(f' {dorm[i][j][k]}', end='')
        print('')
    if i != 3:
        print('

Solution (Python):
N = int(input())
b1 = dict()
b2 = dict()
b3 = dict()
b4 = dict()

for i in range(1,4):
  for j in range(1,11):
    idx = i*10+j
    b1[idx] = 0
    b2[idx] = 0
    b3[idx] = 0
    b4[idx] = 0

builds = [b1, b2 ,b3 ,b4]

for i in range(N):
  a = list(map(int,input().split()))
  idx = a[1] * 10 + a[2]
  builds[a[0] - 1][idx]  += a[3]

for b in range(4):
  d = builds[b]
  for i in range(11,21):
    print(" {}".format(d[i]),end="")
  print()
  for i in range(21,31):
    print(" {}".format(d[i]),end="")
  print()
  for i in range(31,41):
    print(" {}".format(d[i]),end="")
  print()
  if b < 3:
    print("

Solution (Python):
OH = [[[0]*10 for i in range (0,3)] for k in range (0,4)]
odd = int(input())
for loop in range(odd):
    house_id,floor,room,add = map(int,input().split())
    OH[house_id-1][floor-1][room-1] += add
for t in range(4):
  for g in range(3):
    for i in range(10):
      if i == 9 :
          print(" %d"%(OH[t][g][i]))
      else:
       print(" %d"%(OH[t][g][i]),end="")
  if t < 3:
   print("

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

home =[[[0]*10 for i in range(3)]for i in range(4)]

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

for i in range(4):
    for j in range(3):
        print("",*home[i][j])
    if i < 3 :
        print("

Solution (Python):
n = int(input())
apa = [[[0]*10 for i in range(3)] for j in range(4)]
for i in range(n):
    inp = list(map(int,input().split()))
    apa[inp[0]-1][inp[1]-1][inp[2]-1] += inp[3]

for j in range(4):
    for i in range(3):
        for k in range(10):
            print(" %d"%apa[j][i][k],end="")
        print("")
    if j <3:
        print("

Solution (Python):
N = int(input())
B = [[[0] * 10 for _ in range(3)] for _ in range(4)]

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

for i, b in enumerate(B):
    if i != 0:
        print('
    for f in b:
        print(' ', end='')
        print(*f)

Solution (Python):
base_num = input()
a = int(base_num)
end_num = 0

input_list = []
while True:
    base_suit = input()
    input_list.append(base_suit)

    end_num += 1
    if a == end_num:
        break

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

for i in input_list:
    t = i.split(' ')
    b = int(t[0]) - 1
    f = int(t[1]) - 1
    r = int(t[2]) - 1
    v = int(t[3])

    count[b][f][r] = count[b][f][r] + v

for i, b in enumerate(count):
    for f in b:
        for r in f:
            print(" {}".format(r),end='')
        print()
    if i + 1 != len(count):
        print('

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

num = int(input())

for count in range(num):
    b, f, r, v = map(int, input().split()) 
    tbl[b-1][f-1][r-1]= tbl[b-1][f-1][r-1] + v
    if tbl[b-1][f-1][r-1] > 9:
        tbl[b-1][f-1][r-1] = 9
    if tbl[b-1][f-1][r-1] < 0:
        tbl[b-1][f-1][r-1] = 0

for i, row in enumerate(tbl):
    for j, elem in enumerate(row):
        for n, test in enumerate(elem):
            print(" ", end = "")
            print(tbl[i][j][n], end = "")
        print()
    if i != 3:
        print('

Solution (Python):
lis = [[[0 for i in range(10)] for j in range(3)] for k in range(4)]
N = int(input())
for l in range(N):
    a,b,c,d,=map(int,input().split())
    lis[a-1][b-1][c-1]+=d
for i in range(4):
    for j in range(3):
        for k in range(10):
            print(" "+str(lis[i][j][k]),end="")
        print()
    if i<3:
        print("

Solution (Python):
n = int(input())
info = []
cnt = 0


ans1 = [[0] * 10 for i in range(3)]
ans2 = [[0] * 10 for i in range(3)]
ans3 = [[0] * 10 for i in range(3)]
ans4 = [[0] * 10 for i in range(3)]

while True:
    b, f, r, v = map(int, input().split())
    info.append([b, f, r, v])
    cnt += 1
    if cnt == n:
        break

for i in range(len(info)):
    if info[i][0] == 1:
        ans1[info[i][1]-1][info[i][2]-1] += info[i][3]
    
    elif info [i][0] == 2:
        ans2[info[i][1]-1][info[i][2]-1] += info[i][3]

    elif info [i][0] == 3:
        ans3[info[i][1]-1][info[i][2]-1] += info[i][3]

    else:
        ans4[info[i][1]-1][info[i][2]-1] += info[i][3]

for i in range(3):
    print("", " ".join(map(str, ans1[i])))
print(20*'

for i in range(3):
    print("", " ".join(map(str, ans2[i])))
print(20*'

for i in range(3):
    print("", " ".join(map(str, ans3[i])))
print(20*'

for i in range(3):
    print("", " ".join(map(str, ans4[i])))

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

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

for b in range(len(room_list)):
    for f in room_list[b]:
        print("", *f)
    if b != len(room_list)-1:
        print("

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

n = int(input())
i = 1

while n >= i:
    b, f, r, v = map(int, input().split())
    m[b-1][f-1][r-1] += v
    i += 1

bc, fc, rc = 0, 0, 0
while 4 > bc:
    while 3 > fc:
        while 10 > rc:
            if rc != 9:
                print(" {}".format(m[bc][fc][rc]), end = "")
            if rc == 9:
                print(" {}".format(m[bc][fc][rc]))
            rc += 1
        rc = 0
        fc += 1
    if bc != 3:
        print("
    fc = 0
    bc += 1

Solution (Python):


home = [[[0 for i in range(10)]for j in range(3)]for k in range(4)]
for l in range(int(input())):
    data = list(map(int,input().split()))
    b = data[0]
    f= data[1]
    r= data[2]
    v= data[3]

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

for n in range(0,4):
    for m in home[n]:
        for o in m:
            print(" "+str(o),end="")
            
        print()
    if n<3:
        print("

Solution (Python):
N=int(input())
room=[[[0]*10 for _ in range(3)] for _ in range(4)]

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

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

Solution (Python):
def main():
    table = [[[0]*10 for i in range (0,3)] for j in range (0,4)]

    N = int(input())
    for i in range(N):
         b_num, f_num, r_num, v_num = map(int, input().split())
         table[b_num-1][f_num-1][r_num-1] += v_num

    

    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()

if __name__ == '__main__':
  main()

Solution (Python):
B = [[[0]*10 for i in range(3)] for j in range(4)]
n = int(input())

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

B_str = [[[str(x) for x in y] for y in z] for z in B]

for b in range(4):
    for f in range(3):
        l = B_str[b][f]
        print(" " + " ".join(l))
    if b != 3:
        print("

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

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

persons = [0] * 120

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

for j in range(4):
	if j >= 1:
		print("
	for h in range(3):
		for w in range(10):
			print(" %d" %(persons[w + h * 10 + j * 30]), end='')
		print()

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

one = [[0 for _ in range(10)] for _ in range(3)]
two = [[0 for _ in range(10)] for _ in range(3)]
three = [[0 for _ in range(10)] for _ in range(3)]
four = [[0 for _ in range(10)] for _ in range(3)]

d = {1:one,2:two,3:three,4:four}

while n > 0:
    b,f,r,v = map(int,input().split())
    d[b][f-1][r-1] += v
    n-= 1

c = 0
for N in [one,two,three,four]:
    for f in N:
        print(" "+" ".join([str(i) for i in f]))
    c +=1
    if c != 4:
        print("

Solution (Python):
count = [[[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(x) for x in input().split())
    count[b - 1][f - 1][r - 1] += v

for b in range(4):
    for f in range(3):
        for r in range(10):
            print("", count[b][f][r], end="")
        print()
    if (b != 3) : print("

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

for b in range(4):
    for f in range(3):
        for r in range(10):
            print(f" {buildings[b][f][r]}", end="")
        print()
    if b <= 2:
        print("

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):
Tou = [[[0 for _ in range(10)] for _ in range(3)] for _ in range(4)]

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

for i in range(4):
    for j in range(3):
        sent =' '
        for k in range(10):
            sent = sent + str(Tou[i][j][k]) + ' '
        print(sent[:-1])
    if i != 3:
        print("

Solution (Python):

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

n = int(input())


for i in range(n):
    tower, floor, number, people = map(int, input().split())
    table[tower-1][floor-1][number-1] += people
    
x = 0
for i in range(4):
    
    
    if x != 0:
        print('
    x += 1
    
    for j in range(3):
        for k in range(10):
            
            print(' %d'%(table[i][j][k]), end="")
        print()

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

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

Solution (Python):
building_num = 4
floor_num = 3

m = []
for i in range(building_num):
    building = []
    for j in range(floor_num):
        floor = [0] * 10
        building.append(floor)
    m.append(building)

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

delimiter = '
for i in range(building_num):
    building = m[i]
    for floor in building:
        for room in floor:
            print(f' {room}', end='')
        print()

    if i != building_num - 1:
        print(delimiter)

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

for j, b in enumerate(room):
    for f in b:
        for r in f:
            print('', r, end='')
        print()

    if j != 3: print('

Solution (Python):
n = int(input())
r = [[["0" for i in range(10)] for j in range(3)] for k in range(4)]
for i in range(n):
    m = list(map(int,input().split()))
    r[m[0]-1][m[1]-1][m[2]-1] = str(int(r[m[0]-1][m[1]-1][m[2]-1])+m[3])
for i,l in enumerate(r):
    for j in l:
        print(" " + " ".join(j))
    if i != 3:
        print("

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

for i in range(4):
    for j in range(3):
        ans = [str(_) for _ in rooms[i][j]]
        print(' '+' '.join(ans))
    else:
        if i != 3:
            print('

Solution (Python):
tbl = [[[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())
    if tbl[b-1][f-1][r-1] == 0:
        tbl[b-1][f-1][r-1] = v
    else:
        tbl[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(tbl[k][j][i], end='')
        print()
    if k != 3:
        print('

Solution (Python):
N=int(input())
room=[[[0]*10 for _ in range(3)] for _ in range(4)]

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

for i in range(4):
    for j in range(3):
        for k in range(10):
            print(" {}".format(room[i][j][k]), end="")
        print()
    if i!=3:
        print("

Solution (Python):
n = int(input())
a = list()
for i in range(120):
	a.append(0)
for i in range(n):
	b, f, r, v = map(int, input().split())
	a[(b - 1) * 30 + (f - 1) * 10 + (r - 1)] += v
for i in range(4):
	if i >= 1:
		print("
	for j in range(3):
		for k in range(10):
			print(' ', end = '')
			print(a[i * 30 + j * 10 + k], end = '')
		print()

Solution (Python):
builds = [[[0]*10 for i in range (0,3)] for k in range (0,4)]

n = int(input())

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

for i, building in enumerate(builds):
    for floor in building:
        for room in floor:
            print(" {}".format(room), end="")
        print()
    if i != 3:
        print("

Solution (Python):
N = int(input())
room = [[0 for i in range(30)] for j in range(4)]
s = "

for i in range(N):
    info = input().split()
    room[int(info[0])-1][(int(info[1])-1)*10+int(info[2])-1] += int(info[3])
for i in range(4):
    print("",*room[i][:10])
    print("",*room[i][10:20])
    print("",*room[i][20:30])
    if i != 3:
        print(s)

Solution (Python):
room=[[[0]*10 for i in range(0,3)]for j in range(0,4)]
N=int(input())
for i in range (N):
    a,b,c,d=input().split()
    a,b,c,d=[int(a),int(b),int(c),int(d)]
    room[a-1][b-1][c-1]=room[a-1][b-1][c-1]+d
for i in range(4):
    for j in range(3):
        result=" ".join([str(m) for m in room[i][j]])
        print("",result)
    if i==3:
        break
    print("

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

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

Solution (Python):
n = int(input())
room = [[[0 for i in range(10)] for j in range(3)] for k in range(4)]

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

for c in range(4):
    for d in range(3):
        print('',*room[c][d])
    if c != 3:
        print('

Solution (Python):
N = int(input())
bfr = [[[0]*10 for i in range(3)] for j in range(4)]
for i in range(N):
    b, f, r, v = [int(n) for n in input().split()]
    bfr[b-1][f-1][r-1] += v
c = 0
for B in bfr:
    for F in B:
        print('{:>20}'.format(' '.join([str(c) for c in F])))
    c += 1
    if c < 4:
        print('

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

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

Solution (Python):
n = int(input())
arr = [ [ [0]*10 for j in range(3) ] for i in range(4) ]
i = 0
while i < n:
    a, b, c, d = map(int,input().split())
    arr[a-1][b-1][c-1] += d
    i += 1
for i in range(4):
    if i > 0:
        print('
    for j in range(3):
        print('', *arr[i][j])

Solution (Python):
targets = [[[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())
	targets[b - 1][f - 1][r - 1] += v
s = '
index = 0
for target in targets:
	for t in target:
		print(' ' + ' '.join(list(map(str, t))))
	if index < 3: 
		print(s)
	index += 1

Solution (Python):
n = int(input())
x = [[int(x) for x in input().split()] for _ in range(n)]

house0 = [[0 for _ in range(10)] for _ in range(3)]
house1 = [[0 for _ in range(10)] for _ in range(3)]
house2 = [[0 for _ in range(10)] for _ in range(3)]
house3 = [[0 for _ in range(10)] for _ in range(3)]
house = [house0, house1, house2, house3]

for b, f, r, v in x:
    house[b-1][f-1][r-1] += v

for i, item in enumerate(house):
    for row in item:
        print(' ', end='')
        print(*row)
    if i < 3:
        print('

Solution (Python):
Rooms = [[[0 for i in range(10)] for ii in range(3)] for iii in range (4)]
num = int(input())
for i in range(num):
    b, f, r, v = map(int, input().split())
    Rooms[b-1][f-1][r-1] += v
    
for i in range(15):
    if i % 4 == 3: 
        print("
    else:
        b = i // 4
        f = i % 4
        print(" " + " ".join(map(str, Rooms[b][f])))

Solution (Python):
def output(A):
    for i in range(3):
        print(" ",end="")
        print(*A[i])

a = [[0 for i in range(10)] for j in range(3)]
b = [[0 for i in range(10)] for j in range(3)]
c = [[0 for i in range(10)] for j in range(3)]
d = [[0 for i in range(10)] for j in range(3)]

N = int(input())
for _ in range(N):
    bb,f,r,v = map(int,input().split())
    r -= 1
    f -= 1
    if bb == 1:
        a[f][r] += v
    elif bb == 2:
        b[f][r] += v
    elif bb == 3:
        c[f][r] += v
    else:
        d[f][r] += v

output(a)
print("
output(b)
print("
output(c)
print("
output(d)

Solution (Python):
n = int(input())
listA = [list(map(int, input().split(" "))) for i in range(n)]

b = []
f = []
r = []
v = []
for building in range(4):
    for floor in range(3):
        for room in range(10):
            r.append(0)
        f.append(r)
        r = []
    b.append(f)
    f = []

for i in listA:
    b[i[0]-1][i[1]-1][i[2]-1] += i[3]

for idx, building in enumerate(b):
    for floor in building:
        print(" " + " ".join(map(str, floor)))
    if idx < 3:
        print("

Solution (Python):



N = int(input())


room_info = [[[0]*10 for i in range(3)] for j in range(4)]


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


for b in range(4):
    for f in range(3):
        print(" ", end="")
        rooms = room_info[b][f]
        rooms = list(map(str, rooms))
        print(" ".join(rooms))
    if not b==3:
        print("

Solution (Python):
def main():
    n = int(input())
    l = [[[0 for _ in range(10)] for _ in range(3)] for _ in range(4)]
    
    for _ in range(n):
        b,f,r,v = map(int,input().split())
        b -= 1
        f -= 1
        r -= 1
        l[b][f][r] += v
    
    for i,b in enumerate(l):
        for f in b:
            s = ""
            for r in f:
                s += " " + str(r)
            print(s)
        if i != 3:print("


if __name__ == '__main__':
    main()

Solution (Python):
n=int(input())
x=0
i=0
building=[[[0 for i in range(10)] for i in range(3)] for i in range(4)]
while x<n:
    b,f,r,v = map(int, input().split())
    building[b-1][f-1][r-1]+=v
    x += 1
for build in building:
    for floor in build:
        print("",*floor)
    if i<3:
        print("
        i+=1
    else:
        i+=1

Solution (Python):
n = int(input())
count = [[[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())
    count[b-1][f-1][r-1] += v
i = 0
for floor in count:
    i+=1
    for room in floor:
        for visitor in room:
            print("",visitor,end ="")
        print("")
    if(i!=4):
        print("

Solution (Python):
count = [[[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())
    count[b-1][f-1][r-1] += v
for i in range(4):
    for j in range(3):
        for k in range(10):
            if k == 9:
                print(f' {count[i][j][k]}')
            else:
                print(f' {count[i][j][k]}', end='')
    if i != 3:
        print('

Solution (Python):
n = int(input())
l = [0] * 10*12

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

k = 0
for i in range(15):
    if (i+1)%4 == 0:
        print ('
        k += 1
    else:
        for j in range(10):
            print (' ' + str(l[((0+i-k)*10)+j]), end='')
        print ()

Solution (Python):
a = [[0 for i in range(10)] for j in range(12)]

n = int(input())
for i in range(n):
    b, f, r, v = map(int, input().split())
    a[3 * b + f - 4][r - 1] += v
    
for i, j in enumerate(a):
    if i % 3 == 0 and i != 0:
        print('
    print("", *j)

Solution (Python):
h = [[[0]*10 for i in range(3)] for j in range(4)]
for i in range(int(input())):
    b,f,r,k = map(int,input().split())
    h[b-1][f-1][r-1]+=k
for i in range(4):
    for j in h[i]: print('',*j)
    if i<3: print('

Solution (Python):
n = int(input())
li = [list(map(int,input().split())) for _ in range(n)]

check = [[0]*10 for _ in range(12)]

for i in range(n):
    b = li[i][0]
    f = li[i][1]
    r = li[i][2] - 1
    check[(b-1)*3 + f-1][r] += li[i][3]
    
for i in range(12):
    for j in range(10):
        if j == 9:
            print(" " + str(check[i][j]))
        else:
            print(" " + str(check[i][j]), end="")
    else:
        if i == 2 or i == 5 or i == 8:
            print("

Solution (Python):
info = [[[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(x) for x in input().split())
    info[b-1][f-1][r-1] += v

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

Solution (Python):
n=int(input())
list_=[[[0 for x in range(10)] for y in range(3)] for z in range(4)]
for i in range(n):
    b,f,r,v=map(int,input().split())
    list_[b-1][f-1][r-1]+=v
count=0
for a in list_:
    for c in a:
        print(" ",end="")
        
        print(" ".join(map(str,c)))
    if count!=3:
        print("
    count+=1

Solution (Python):

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

n = int(input())
for _ in range(n):
    a,b,c,d = map(int,input().split())
    f[a-1][b-1][c-1] += d

for i in range(4):
    for j in range(3):
        for k in range(10):
            print(" %d"%(f[i][j][k]),end='')
        print()
    if i<3:print ('

Solution (Python):
def construct_floor(num_rooms):
    return [0] * num_rooms


def construct_building(num_floors, num_rooms):
    building = []

    for i in range(num_floors):
        building.append(construct_floor(num_rooms))

    return building


def construct_buildings(num_buildings, num_floors, num_rooms):
    buildings = []

    for i in range(num_buildings):
        buildings.append(construct_building(num_floors, num_rooms))

    return buildings


def floor_to_string(floor):
    room_strings = list(map(str, floor))

    return ' ' + ' '.join(room_strings)


def building_to_string(building):
    floor_strings = list(map(floor_to_string, building))

    return '\n'.join(floor_strings)


def show_buildings(buildings):
    building_strings = list(map(building_to_string, buildings))

    separator = ''.join(['

    separator = '\n' + separator + '\n'

    buildings_string = separator.join(building_strings)

    print(buildings_string)


if __name__ == "__main__":
    num_inputs = int(input())

    inputs = []

    for i in range(num_inputs):
        inputs.append(input())

    tenant_leaver_notices = list(
        map(lambda input_value: list(map(int, input_value.split())), inputs)
    )

    official_house = construct_buildings(4, 3, 10)

    for tenant_leaver_notice in tenant_leaver_notices:
        building = tenant_leaver_notice[0] - 1
        floor = tenant_leaver_notice[1] - 1
        room = tenant_leaver_notice[2] - 1
        num_people = tenant_leaver_notice[3]

        official_house[building][floor][room] += num_people

    show_buildings(official_house)

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

n = int(input())


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


for building_no, no in zip(Tatemono, range(len(Tatemono))):
    for floor_no in building_no:
        for room_no in floor_no:
            print(" ",end ="")
            print(room_no,end="")

        print("")

    if len(Tatemono) == no+1:
        break

    print("

Solution (Python):
import math
import copy
from copy import deepcopy
import sys
import fractions

from functools import reduce

import decimal
import heapq
import collections
import itertools
sys.setrecursionlimit(100001)






def getInputInt():
    inputNum = int(input())
    return inputNum


def getInputListInt():
    outputData = []
    inputData = input().split()
    outputData = [int(n) for n in inputData]

    return outputData


def getSomeInputInt(n):
    outputDataList = []
    for i in range(n):
        inputData = int(input())
        outputDataList.append(inputData)

    return outputDataList


def getSomeInputListInt(n):
    inputDataList = []
    outputDataList = []
    for i in range(n):
        inputData = input().split()
        inputDataList = [int(n) for n in inputData]
        outputDataList.append(inputDataList)

    return outputDataList




n = int(input())

d = getSomeInputListInt(n)

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

for b, f, r, v in d:
    buildings[b-1][f-1][r-1] += v

for i in range(4):
    for j in range(3):
        print("",*buildings[i][j], sep=" ")

    if i!=3:
        for k in range(20):
            print("
        print()

Solution (Python):
num = int(input())
a = [[0] * 10 for i in range(3)]
b = [[0] * 10 for i in range(3)]
c = [[0] * 10 for i in range(3)]
d = [[0] * 10 for i in range(3)]
for i in range(num):
  s = input().rstrip().split(' ')
  bild = int(s[0])
  floor = int(s[1])
  room = int(s[2])
  member = int(s[3])
  if bild == 1:
    a[floor-1][room-1] += member
  elif bild == 2:
    b[floor-1][room-1] += member
  elif bild == 3:
    c[floor-1][room-1] += member
  elif bild == 4:
    d[floor-1][room-1] += member

for j in range(3):
  ans = " "
  for k in range(9):
    ans = ans + str(a[j][k]) + " "
  ans += str(a[j][9])
  print(ans)
print("
for l in range(3):
  ans = " "
  for m in range(9):
    ans = ans + str(b[l][m]) + " "
  ans += str(b[l][9])
  print(ans)
print("
for n in range(3):
  ans = " "
  for o in range(9):
    ans = ans + str(c[n][o]) + " "
  ans += str(c[n][9])
  print(ans)
print("
for p in range(3):
  ans = " "
  for q in range(9):
    ans = ans + str(d[p][q]) + " "
  ans += str(d[p][9])
  print(ans)

Solution (Python):

n = int(input())
a = list()
for i in range(120):
	a.append(0)
for i in range(n):
	b, f, r, v = map(int, input().split())
	a[(b - 1) * 30 + (f - 1) * 10 + (r - 1)] += v
for i in range(4):
	if i >= 1:
		print("
	for j in range(3):
		for k in range(10):
			print(' ', end = '')
			print(a[i * 30 + j * 10 + k], end = '')
		print()