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):
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):
n=int(input())
m=[[[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())
    m[b-1][f-1][r-1]+=v
for i in range(4):
    for j in range(3):
        for k in range(10):
            print(" "+str(m[i][j][k]),end="")
        print()
    if(i!=3):
        print("

Solution (Python):
n=int(input())
a=[[[0 for i in range(10)] for j in range(3)] for k in range(4)]
for l 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(3):
        for k in range(10):
            print(" "+str(a[i][j][k]), end="")
        print()
    if i!=3:
        print("

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

Solution (Python):
n=int(input())
a=[[[0 for l 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 j in range(4):
    for k in range(3):
        for l in range(10):
            print(' '+str(a[j][k][l]), end='')
        print()
    if(j!=3):
        print('

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

Solution (Python):
n = int(input())
tbl = [[[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())
    tbl[b-1][f-1][r-1] += v
    
for k in range(4):
    for j in range(3):
        for i in range(10):
            print(" {}".format(tbl[k][j][i]),end="")
        print()
    if k!=3:
        print("

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

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

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

b_cnt = 0
for floor in count:
    if b_cnt != 0:
        print("
    b_cnt += 1
    
    for room in floor:
        print("", *room)

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

    
for x in range(4):
    y=0
    for y in range(3):
        bf=l1[x][y]
        print(" "+" ".join(map(str, bf)))
        y=y+1
    if x<3:
        print("
        x=x+1
    else:
        break

Solution (Python):
n = int(input())
L = [[[0]*10 for i in range(3)] for j in range(4)]
cnt = 0
while cnt < n:
    b, f, r, v = map(int, input().split())
    L[b-1][f-1][r-1] += v
    cnt += 1
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 != 3:
        print('

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

p = [[0] * 30 for x in range(4)]

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

for i in range(0, 4):
  if i >= 1:
    print('
  for j in range(0, 3):
    for k in range(0, 10):
      print(' ', end='')
      print(p[i][j * 10 + k], end = '')
    print()

Solution (Python):
c = [[[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())
    c[b-1][f-1][r-1]+=v
for i in range(4):
    for j in range(3):
        print(' '+' '.join(map(str,c[i][j])))
    if i < 3:
        print('

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

for bi, b in enumerate(rooms):
    for f in b:
        print('', *f)
    if 0 <= bi < 3:
        print('

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

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

Floor_list = [[[0 for x in range(10)] for j in range(3)] for i in range(4)]

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

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

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

n = int(input())

for _ in range(n):
    b, f, r, v = map(int, input().split())
    table[b-1][f-1][r-1] += v
    
i = 0
for building in table:
    for floor in building:
        print(' ' + ' '.join(list(map(str, floor))))
    if i != 3:
        print('
    i += 1

Solution (Python):
count=int(input())
aBuilding = [[0 for j in range(10)] for i in range(3)]
bBuilding = [[0 for j in range(10)] for i in range(3)]
cBuilding = [[0 for j in range(10)] for i in range(3)]
dBuilding = [[0 for j in range(10)] for i in range(3)]

for i in range(count):
    b,f,r,v = map(int,input().split())
    if b ==1:
        aBuilding[f-1][r-1]+=v
    elif b ==2:
        bBuilding[f-1][r-1]+=v        
    elif b ==3:
        cBuilding[f-1][r-1]+=v
    elif b ==4:
        dBuilding[f-1][r-1]+=v

def printInfo(building):
    for i in range(3):
        for x in range(10):
            print('',end=' ')
            print(building[i][x] , end='')
        print('')
printInfo(aBuilding)
print('
printInfo(bBuilding)
print('
printInfo(cBuilding)
print('
printInfo(dBuilding)

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):
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 = list(map(int, input().split()))
    buildings[b - 1][f - 1][r - 1] += v

for b in range(len(buildings)):
    if 0 < b:
        print("

    for f in range(len(buildings[b])):
        for r in range(len(buildings[b][f])):
            print(" " + str(buildings[b][f][r]), end="")
        print()

Solution (Python):





def main():
    A = [[[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())
        A[b-1][f-1][r-1] += v
    for i in range(4):
        for j in range(3):
            print(" ", end="")
            print(*A[i][j])
        if i < 3:
            print("


if __name__ == '__main__':
    main()

Solution (Python):
n = int(input())
inputs = [list(map(int, input().split())) for _ in range(n)]
values = [[[0 for _ in range(10)] for _ in range(3)] for _ in range(4)]
for i in inputs:
    values[i[0]-1][i[1]-1][i[2]-1] += i[3]
for b in range(4):
    for f in range(3):
        print(' ', end='')
        print(*values[b][f])
    if b != 3:
        print('

Solution (Python):
n = int(input())
residents = [0]*4*3*10


for i in range(n):
  info = list(map(int, input().split()))
  room_num = (info[0]-1)*30 + (info[1]-1)*10 + info[2] -1
  residents[room_num] += info[3]

for i in range(4):
  for j in range(3):
    for k in range(10):
      room_num = i*30 + j*10 + k
      print('',residents[room_num],end='')
    print('')
  if i != 3:
    print('

Solution (Python):
N=int(input())
W=[[[0]*10 for _ in range(3)]for _ in range(4)]
for i in range(N):
    bil,col,row,e=map(int,input().split())
    W[bil-1][col-1][row-1]+=e
for k in range(4):
  if k!=0:
    print("
  for u in range(3):
    for j in range(10):
      print(f" {W[k][u][j]}",end="")
      if j==9:
        print()

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

for i in range(n):
  b,f,r,v=(int(x) for x in input().split())
  if b==1:
    A[f-1][r-1]+=v
  if b==2:
    B[f-1][r-1]+=v
  if b==3:
    C[f-1][r-1]+=v
  if b==4:
    D[f-1][r-1]+=v

for i in range(3):
  for j in range(10):
    print(" ",A[i][j],sep="",end="")
  print("")
print("

for i in range(3):
  for j in range(10):
    print(" ",B[i][j],sep="",end="")
  print("")
print("

for i in range(3):
  for j in range(10):
    print(" ",C[i][j],sep="",end="")
  print("")
print("

for i in range(3):
  for j in range(10):
    print(" ",D[i][j],sep="",end="")
  print("")

Solution (Python):

num = int(input())

b1f1list = [0]*10
b1f2list = [0]*10
b1f3list = [0]*10

b2f1list = [0]*10
b2f2list = [0]*10
b2f3list = [0]*10

b3f1list = [0]*10
b3f2list = [0]*10
b3f3list = [0]*10

b4f1list = [0]*10
b4f2list = [0]*10
b4f3list = [0]*10

for i in range(num):
    b,f,r,v = (int(x) for x in input().split())

    if (b == 1):
        if (f == 1):
            b1f1list[r-1] = b1f1list[r-1]+v

        elif (f == 2):
            b1f2list[r-1] = b1f2list[r-1] + v

        elif (f == 3):
            b1f3list[r-1] = b1f3list[r-1] + v


    elif (b == 2):
        if (f == 1):
            b2f1list[r-1] = b2f1list[r-1]+v

        elif (f == 2):
            b2f2list[r-1] = b2f2list[r-1] + v

        elif (f == 3):
            b2f3list[r-1] = b2f3list[r-1] + v

    elif (b == 3):
        if (f == 1):
            b3f1list[r-1] = b3f1list[r-1]+v

        elif (f == 2):
            b3f2list[r-1] = b3f2list[r-1] + v

        elif (f == 3):
            b3f3list[r-1] = b3f3list[r-1] + v

    elif (b == 4):
        if (f == 1):
            b4f1list[r-1] = b4f1list[r-1]+v

        elif (f == 2):
            b4f2list[r-1] = b4f2list[r-1] + v

        elif (f == 3):
            b4f3list[r-1] = b4f3list[r-1] + v


for i in range(10) :
    print(" "+str(b1f1list[i]), end = "")
print("")
for i in range(10) :
    print(" "+str(b1f2list[i]), end = "")
print("")
for i in range(10) :
    print(" "+str(b1f3list[i]), end = "")
print("")
print("

for i in range(10) :
    print(" "+str(b2f1list[i]), end = "")
print("")
for i in range(10) :
    print(" "+str(b2f2list[i]), end = "")
print("")
for i in range(10) :
    print(" "+str(b2f3list[i]), end = "")
print("")
print("

for i in range(10) :
    print(" "+str(b3f1list[i]), end = "")
print("")
for i in range(10) :
    print(" "+str(b3f2list[i]), end = "")
print("")
for i in range(10) :
    print(" "+str(b3f3list[i]), end = "")
print("")
print("

for i in range(10) :
    print(" "+str(b4f1list[i]), end = "")
print("")
for i in range(10) :
    print(" "+str(b4f2list[i]), end = "")
print("")
for i in range(10) :
    print(" "+str(b4f3list[i]), end = "")
print("")

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

for b in range(4):
    for f in houses[b]:
        print('', *f)
    if b != 3:
        print('

Solution (Python):
rooms = [[[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 = list(map(int, input().split()))
    rooms[b - 1][f - 1][r - 1] += v
for i in range(4):
    for j in range(3):
        print(' ', end='')
        print(*[rooms[i][j][k] for k in range(10)])
    if i != 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):
list = [[[0 for room in range(10)] for floor in range(3)] for building in range(4)]

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

temp = 0
for building in list:
    if not temp == 0:
        print('
    temp += 1
    for floor in building:
        for room in floor:
            print(f' {room}', end='')
        print()

Solution (Python):
bldg=[[[0 for i in range(10)]for j in range(3)]for k in range(4)]
n=int(input())
for i in range(n):
    var=input()
    var=var.split()
    b=int(var[0])-1
    f=int(var[1])-1
    r=int(var[2])-1
    v=int(var[3])
    bldg[b][f][r]+=v
count=0
for building in bldg:
    for floor in building:
        for room in floor:
            print(" "+str(room),end='')
        print()
    if(count==3):
        break
    print("
    count+=1

Solution (Python):
N = int(input())
lst = [[0]*10 for _ in range(12)]
for i in range(N):
    a,b,c,d = map(int,input().split())
    lst[3*(a-1)+b-1][c-1] += d
for j in range(12):
    if j in [3,6,9]:
        print("
    print(" ", end = "")
    print(*lst[j])

Solution (Python):
B = []
for _ in range(4):
    b = [[0] * 10 for _ in range(3)]
    B.append(b)
n = int(input())
for _ in range(n):
    b, f, r, v = map(int, input().split())
    B[b - 1][f - 1][r - 1] += v
for i in range(4):
    for j in range(3):
        for Bi in B[i][j]:
            print('', Bi, end='')
        print()
    if i == 3:
        break
    print('

Solution (Python):
num=int(input())
info=[list(map(int,input().split(" ")))for i in range(num)]
control=[[[0 for i in range(10)]for j in range(3)]for k in range(4)]
for i in info:
    control[i[0]-1][i[1]-1][i[2]-1]+=i[3]

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

Solution (Python):
FLOORS = 3
ROOMS = 10
SEPARATOR = "


def generate_empty_building():
    return [[0 for _ in range(ROOMS)] for _ in range(FLOORS)]


def output_building(single_building):
    for floor in single_building:
        print(" " + " ".join(str(room) for room in floor))


building_one = generate_empty_building()
building_two = generate_empty_building()
building_three = generate_empty_building()
building_four = generate_empty_building()

notices = int(input())

for _ in range(notices):
    building_num, floor_num, room_num, people = [int(x) for x in input().split()]

    if building_num == 1:
        building_one[floor_num - 1][room_num - 1] += people
    if building_num == 2:
        building_two[floor_num - 1][room_num - 1] += people
    if building_num == 3:
        building_three[floor_num - 1][room_num - 1] += people
    if building_num == 4:
        building_four[floor_num - 1][room_num - 1] += people

buildings = [building_one, building_two, building_three, building_four]

i = 0

for building in buildings:
    i += 1
    output_building(building)
    if i < 4:
        print(SEPARATOR)

Solution (Python):
n = int(input())
i = 0
hins = []
while i < n:
    hin = list(map(int, input().split()))
    hins.append(hin)
    i += 1

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

for i in range(n):
    hin = hins[i]
    
    tou = str(hin[0] - 1)
    kai = hin[1] - 1
    hey = hin[2] - 1
    nin = hin[3]
    

    if tou == "0":
        a[kai][hey] = a[kai][hey] + nin
    elif tou == "1":
        b[kai][hey] = b[kai][hey] + nin
    elif tou == "2":
        c[kai][hey] = c[kai][hey] + nin
    elif tou == "3":
        d[kai][hey] = d[kai][hey] + nin
aida = "

for i in range(3):
    for j in range(10):
        if j == 9:
            print(" {}" .format(a[i][j]))
        else:
            print(" {}" .format(a[i][j]), end="")
print(aida)
for i in range(3):
    for j in range(10):
        if j == 9:
            print(" {}" .format(b[i][j]))
        else:
            print(" {}" .format(b[i][j]), end="")
print(aida)
for i in range(3):
    for j in range(10):
        if j == 9:
            print(" {}" .format(c[i][j]))
        else:
            print(" {}" .format(c[i][j]), end="")
print(aida)
for i in range(3):
    for j in range(10):
        if j == 9:
            print(" {}" .format(d[i][j]))
        else:
            print(" {}" .format(d[i][j]), end="")

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

for i in range(4):
    for j in range(3):
        for k in range(10):
            print(" "+str(room[i][j][k]),end="")
        print()
    if i != 3:
        for x in range(20):
            print("
        print()

Solution (Python):
aparts = {
    '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]],
    '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]],
    '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]],
    '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]],
}






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

for key, values in aparts.items():
    for value in values:
        print(' '+' '.join(list(map(str, value))))
    if key != '4':
        print(f'{"

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, *B = map(int, open(0).read().split())
buildings = [[[0] * 10 for _ in range(3)] for _ in range(4)]
for i in range(0, len(B), 4):
    b = B[i]
    h = B[i+1]
    w = B[i+2]
    v = B[i+3]
    buildings[b-1][h-1][w-1] += v
for i, b in enumerate(buildings):
    for r in b:
        print(" " + " ".join(map(str, r)))
    if i != 3:
        print("

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

for k in range(4):
    for j in range(3):
        print(" "+" ".join([str(x) for x in build[k][j]]))
    if k!=3:
        print("

Solution (Python):
residence = [0 for i in range(120)]
n = int(input())
count = 0
while count < n:
    b, f, r, v = map(int, input().split())
    residence[(b - 1) * 30 + (f - 1) * 10 + (r - 1)] += v
    count += 1
for i in range(120):
    if i != 0:
        if i % 10 == 0:
            print()
        if i % 30 == 0:
            print("
    if i % 10 < 10:
        print(end=" ")
    print(residence[i], end="")
print()

Solution (Python):
rooms = [[[0 for x in range(10)] for y in range(3)] for z in range(4)]
n = int(input())
for i in range(n):
    b,f,r,v = [int(x) for x in input().split()]
    rooms[b-1][f-1][r-1] += v
for i in range(4):
    for j in range(3):
        for k in range(10):
            print(f" {rooms[i][j][k]}",end='')
        print("")
    if i < 3:
        print("

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

Solution (Python):
n = int(input())
house = [[[0*10 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())
    house[b - 1][f - 1][r - 1] += v

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

Solution (Python):
li = [[[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())

    for j in range(len(li)):
        for k in range(len(li[j])):
            for m in range(len(li[j][k])):
                if j == b-1 and k == f-1 and m == r-1:
                    li[b-1][f-1][r-1] += v

for i in range(len(li)):
    for f in li[i]:
        for r in f:
            print(" {}".format(r), end="")
        print("")
    if i != len(li)-1:
        print("

Solution (Python):
l = [[[0 for k in range(10)] for j 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 i in range(4):
  for j in range(3):
    for k in range(10):
        print("", l[i][j][k], end = "")
    print()
  if i != 3:
    print("

Solution (Python):
ans = [[0]*10 for i in range(12)]
n = int(input())
for i in range(n):
    b,f,r,v = map(int,input().split())
    ans[(b-1)*3+f-1][r-1] += v
for i in range(0,12):
    if i%3 == 0 and i > 0:
        print('
    print('',' '.join(map(str,ans[i][:])))

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

for i, block in enumerate(total_live_in):
    if i > 0:
        print("
    for floor in block:
        print(" " + " ".join(map(str,floor)))

Solution (Python):
def pout(i, j):
    print(" ", end="")
    print(*l[j][i], sep=" ")


l = [[[0 for k in range(10)] for j in range(3)] for i in range(4)]
n = int(input())

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

for j in range(4):
    [pout(i, j) for i in range(3)]
    if j != 3:
        print("

Solution (Python):
n = int(input())
l = list()
for i in range(120):
	l.append(0)
for i in range(n):
	b, f, r, v = map(int, input().split())
	l[(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(l[i * 30 + j * 10 + k], end='')
		print()

Solution (Python):
houses = [[[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())
    houses[b-1][f-1][r-1] += v
for b in range(4):
    for f in houses[b]:
        print('', *f)
    if b != 3:
        print('

Solution (Python):
n = int(input())
list = [list(map(int, input().split())) for i in range(n)]
section = [[[0]*10, [0]*10, [0]*10], [[0]*10, [0]*10, [0]*10], [[0]*10, [0]*10, [0]*10], [[0]*10, [0]*10, [0]*10]]
for i in range(n) :
	sec_num = list[i][0]
	floor = list[i][1]
	room_num = list[i][2]
	person = list[i][3]
	
	section[sec_num-1][floor-1][room_num-1] += person

for i in range(3) :
	for j in range(10) :
		print(" ", end="")
		print(section[0][i][j], end="")
		if j == 9 :
			print("")
print("

for i in range(3) :
	for j in range(10) :
		print(" ", end="")
		print(section[1][i][j], end="")
		if j == 9 :
			print("")
print("

for i in range(3) :
	for j in range(10) :
		print(" ", end="")
		print(section[2][i][j], end="")
		if j == 9 :
			print("")
print("

for i in range(3) :
	for j in range(10) :
		print(" ", end="")
		print(section[3][i][j], end="")
		if j == 9 :
			print("")

Solution (Python):
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):
bills = [
    [
        [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
        [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
        [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
    ],
    [
        [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
        [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
        [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
    ],
    [
        [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
        [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
        [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
    ],
    [
        [0, 0, 0, 0, 0, 0, 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 resolve():
    n = int(input())
    for _ in range(n):
        b, f, r, v = map(int, input().split())
        bills[b - 1][f - 1][r - 1] += v

    count = 0
    for bill in bills:
        count += 1
        for floor in bill:
            [print(" {}".format(r), end='') for r in floor]
            print('')
        if count < len(bills):
            print('


resolve()

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

for b in range(4):
    for f in houses[b]:
        print('', *f)
    if b != 3:
        print('

Solution (Python):
n = int(input())
data1 = [[0 for _ in range(10)] for _ in range(3)] 
data2 = [[0 for _ in range(10)] for _ in range(3)]
data3 = [[0 for _ in range(10)] for _ in range(3)]
data4 = [[0 for _ in range(10)] for _ in range(3)]
data_index = [data1, data2, data3, data4]
for _ in range(n):
    b, f, r, v = map(int, input().split())
    data_index[b-1][f-1][r-1] = data_index[b-1][f-1][r-1] + v
for i in range(3):
    for j in range(10):
        print(f' {data1[i][j]}', end='')
    print()
print('
for i in range(3):
    for j in range(10):
        print(f' {data2[i][j]}', end='')
    print()
print('
for i in range(3):
    for j in range(10):
        print(f' {data3[i][j]}', end='')
    print()
print('
for i in range(3):
    for j in range(10):
        print(f' {data4[i][j]}', end='')
    print()

Solution (Python):
n=int(input())
l=[[[0 for R in range(10)] for F in range(3)] for B in range(4)]
for N in range(n):
    b,f,r,v=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(' ',l[i][j][k],sep='',end='')
        print()
    if i!=3:
        print('

Solution (Python):
room = []
for i in range(120):
    room.append(0)


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

    

    room[(b-1)*30 + (f-1)*10 + r-1] += v
    

for tou in range(4):
    for kai in range(3):
        for heya in range(10):
            print(" %d" % room[(tou)*30 + (kai)*10 + heya], end="")
        print()
    if tou < 3:
        print("

Solution (Python):
def ltos(l):
  s=''
  for i in range(len(l)):
    s+=' '
    s+=str(l[i])
    
  print(s)

b1=[[0]*10 for i in range(3)]
b2=[[0]*10 for i in range(3)]
b3=[[0]*10 for i in range(3)]
b4=[[0]*10 for i in range(3)]
b=[b1,b2,b3,b4]

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


for i in range(len(b)):
  for j in range(len(b[i])):
    ltos(b[i][j])
  if i == 3:
    pass
  else:
    print("

Solution (Python):
a = [[0 for j in range(10)] for i in range(3)]
b = [[0 for j in range(10)] for i in range(3)]
c = [[0 for j in range(10)] for i in range(3)]
d = [[0 for j in range(10)] for i in range(3)]
building = [a, b, c, d]
N = int(input())
for i in range(N):
    b, f, r, v = map(int, input().split())
    building[b - 1][f - 1][r - 1] += v
for j in range(4):
    for i in range(3):
        print(" " + " ".join(map(str, building[j][i])))

    if j != 3:
        print("

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

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

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

for i in range(4):
    for line in rooms[i]:
        print(" "+" ".join([str(i) for i in line]))
    if i != 3:
        print("

Solution (Python):
n = int(input())
l = []
for i in range(4):
  l.append([])
  for x in range(3):
    l[i].append([0] * 10)
for nn in range(n):
  b, f, r, v = list(map(int, input().split(' ')))
  l[b - 1][f - 1][r - 1] += v
i = 0
for n in l:
  for nn in n:
    for nnn in nn:
      print(' {0}'.format(nnn), end='')
    print('', sep='\n')
  i += 1
  if i == len(l):
    break
  print('

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

Solution (Python):
n=int(input())
field=[[0 for i in range(20)]for j in range(15)]
for i in range(n):
    b,f,r,v=map(int,input().split())
    h=(b-1)*4+f-1
    w=r*2-1
    n=v
    field[h][w]+=n
for y in range(15):
    for x in range(20):
        if(y%4==3):field[y][x]='
        elif x%2==0 :field[y][x]=' '
        print(field[y][x],end='')
    print()

Solution (Python):
num = int(input())
official_house = [[[0 for _idx3_ in range(10)] for _idx2_ in range(3)] for _idx1_ in range(4)]

for _ in range(num):
    building,floor,room,count = map(int, input().split())
    official_house[building-1][floor-1][room-1] += count

for building in range(4):
    for floor in range(3):
        for room in range(10):
            print(f" {official_house[building][floor][room]}", end="")
        print("")
    if building < 3:
        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("