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):
BUILDINGS = 4
FLOORS = 3
ROOMS = 10

house = [[[0] * ROOMS for i in range(FLOORS)] for j in range(BUILDINGS)]
n = int(input())
for i in range(n):
    b, f, r, v = map(int, input().split())
    house[b-1][f-1][r-1] += v

for b in range(BUILDINGS):
    for f in range(FLOORS):
        for r in range(ROOMS):
            print(' ', house[b][f][r], sep='', end='')
        print()
    if b < BUILDINGS - 1:
        print('

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

for i in range(num):
    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):
        for i in range(10):
            print("",build[k][j][i],end='')
        print()
    if k <= 2:
        print("

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


n = int(input())

for i in range(n):
    i, j, k, v = map(int, input().split())
    mantion[i - 1][j - 1][k - 1] += v

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

Solution (Python):
bld = [0] * 4

for i in range(4):
  bld[i] = [0] * 3
  for j in range(3):
    bld[i][j] = [0] * 10
    
n = int(input())
list = [input() for i in range(n) ]

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

count = 0
for i in bld:
    for j in i:
      print(' ', end='')
      print(*j)
    if count < 3:
      print('
    count += 1

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

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

for i in rooms:
    for j in i:
        for k in j:
            print(' %d'%k, end='')
        print()
    x += 1
    if x < 4:
        print('

Solution (Python):
data_list = [[["0" for i in range(10)] for j in range(3)] for x in range(4)]
number = int(input())

for x in range(number):

    b ,f ,r, v =(int(i) for i in input().split())
    data = data_list[b -1] [f -1][r -1]
    point =int(data) + v
    data_list[b -1] [f -1][r -1] = str(point)
for n in range(4):
    for y in range(3):
        
        for l in range(10):
            print(' ' + data_list[n][y][l], end="")
        print()
    if n < 3:
       
        print('

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

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

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

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

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

Solution (Python):
all_list = []
for i in range(12):
    a = [0] * 10
    all_list.append(a)

n = int(input())
num_list = []

for i in range(n):
    b, f, r, v = map(int, input().split())
    
    if b == 1:
        all_list[f-1][r-1] += v
    elif b == 2:
        all_list[f+2][r-1] += v
    elif b == 3:
        all_list[f+5][r-1] += v
    elif b == 4:
        all_list[f+8][r-1] += v
 
tmp = 0   
for i in all_list:
    print(" ", end="")
    print(*i)
    tmp +=1
    if tmp  == 3 or tmp == 6 or tmp == 9:
        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) :
    if i > 0 :
        print("
    for j in range(3) :
        for k in range(10) :
            print(" ", end = "")
            print(count[i][j][k], end = "")
        print()

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

for i in range(N):
    b,f,r,v = [int(i) for i in 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 = "")
            if k == 9:
                print()
    if i != 3:
        print(s)

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

Solution (Python):
n = int(input())
num = [[[0]*10 for floor in range(3)] for building in range(4)]
for i in range(n):
    b, f, r, v = map(int, input().split())
    num[b-1][f-1][r-1] += v
for building in range(4):
    for floor in range(3):
        for room in range(10):
            print('',num[building][floor][room], end='')
        print()
    if building in range(3):
        print('

Solution (Python):
n = int(input())
info = [[int(arg) for arg in input().split()] for _ in range(n)]
data = [[0]*10 for _ in range(3*4)]
for i in info:
    b, f, r, v = i
    data[3*(b-1)+f-1][r-1] += v

for i, d in enumerate(data):
    if i != 0 and i % 3 == 0:
        print('
    print(' ' + ' '.join([str(i) for i in d]))

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

for _ in range(info):
    build, floor, room, num = map(int, input().split())
    all[build - 1][floor - 1][room - 1] += num
    
def show_building(arr, sep):
    for floor in arr:
        print("", " ".join(map(str, floor)))
        
    if sep:
        print("
        

for build in range(len(all)):
    show_building(all[build], build != 3)

Solution (Python):
n=int(input())
mansion=[[[0]*10 for i in range(3)] for j in range(4)]
for i in range(n):
    b, f, r, v=(int(x) for x in input().split())
    b=b-1
    f=f-1
    r=r-1
    mansion[b][f][r]=mansion[b][f][r]+v
for i in range(4):
    for j in range(3):
        for k in range(10):
            if(k!=9):
                print(" "+str(mansion[i][j][k]), end="")
            else:
                print(" "+str(mansion[i][j][k]))
    if(i!=3):
        print("

Solution (Python):
def initialize_buiding(building):
    for i in range(3):
        building.append([0 for j in range(10)])

def change_room(floor, row, v, building):
    building[floor-1][row-1] += v

def print_university_building(building):
    for floor in building:
        print(' ', end='')
        print(' '.join(map(str,floor)))

def print_hash():
    for i in range(1, 20):
        print('
    print("

uni_building1 = []
uni_building2 = []
uni_building3 = []
uni_building4 = []

initialize_buiding(uni_building1)
initialize_buiding(uni_building2)
initialize_buiding(uni_building3)
initialize_buiding(uni_building4)

n = int(input())

for i in range(n):
    b,f,r,v = (int(x) for x in input().split())
    if b == 1:
        change_room(f,r,v,uni_building1)
    elif b == 2:
        change_room(f,r,v,uni_building2)
    elif b == 3:
        change_room(f,r,v,uni_building3)
    elif b == 4:
        change_room(f,r,v,uni_building4)
    else:
        None

print_university_building(uni_building1)
print_hash()
print_university_building(uni_building2)
print_hash()
print_university_building(uni_building3)
print_hash()
print_university_building(uni_building4)

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

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

for index,tou in enumerate(kousya):
    for kai in tou:
        print(' ' + ' '.join(map(str,kai)))
    if index == len(kousya) - 1:
        continue
    else:
        print('

Solution (Python):

b_1 = [[0] * 10 for a in range(3)]
b_2 = [[0] * 10 for a in range(3)]
b_3 = [[0] * 10 for a in range(3)]
b_4 = [[0] * 10 for a in range(3)]

n = int(input())
while n != 0:
    b,f,r,v = input().split()
    b = int(b)
    f = int(f)
    r = int(r)
    v = int(v)
    if b == 1:
        b_1[f-1][r-1] += v
    if b == 2:
        b_2[f-1][r-1] += v
    if b == 3:
        b_3[f-1][r-1] += v
    if b == 4:
        b_4[f-1][r-1] += v
    n -= 1

for a in b_1:
    for i,b in enumerate(a):
        print(' {}'.format(b),end='')
        if i+1 == len(a):
            print('')
print('
for a in b_2:
    for i,b in enumerate(a):
        print(' {}'.format(b),end='')
        if i+1 == len(a):
            print('')
print('
for a in b_3:
    for i,b in enumerate(a):
        print(' {}'.format(b),end='')
        if i+1 == len(a):
            print('')
print('
for a in b_4:
    for i,b in enumerate(a):
        print(' {}'.format(b),end='')
        if i+1 == len(a):
            print('')

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

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

for i in range(n):
    b,f,r,v=map(int,input().split())
    s[b-1][f-1][r-1]+=v
    
for i in range(3):
    for k in range(10):
        print(' ' +str(s[0][i][k]),end='')
    print()    
print('

for i in range(3):
    for k in range(10):
        print(' ' + str(s[1][i][k]),end='')
    print()
        
print('
for i in range(3):
    for k in range(10):
        print(' ' + str(s[2][i][k]),end='')
    print()
print('

for i in range(3):
    for k in range(10):
        print(' ' + str(s[3][i][k]),end='')
    print()

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

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

for ridge in operate_list[:-1]:
    for floor in ridge:
        for room in floor:
            print(' ', end='')
            print(room, end='')
        print('')
    print('
    
for floor in operate_list[-1]:
    for room in floor:
        print(' ', end='')
        print(room, end='')
    print('')

Solution (Python):
n = int(input())
i = 1
a = [[[0 for k in range(10)] for j in range(3)] for i in range(4)]
while i <= n:
    b,f,r,v = map(int,input().split())
    if a[b-1][f-1][r-1] + v < 0:
        a[b-1][f-1][r-1] = 0
    elif a[b-1][f-1][r-1] + v > 9:
        a[b-1][f-1][r-1] = 9
    else:
        a[b-1][f-1][r-1] = a[b-1][f-1][r-1] + v
    i+=1
for ridge in range(4):
    for floor in range(3):
        for room in range(10):
            print(" {}".format(a[ridge][floor][room]),end="")
        print()
    if ridge == 3:
        break
    print("

Solution (Python):
a = [[10*[0]for _ in[0]*3]for _ in[0]*4]
n = int(input())
for _ 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('',*a[i][j])
    if i < 3:
        print('

Solution (Python):
num = int(input())
building = [[[0 for _ in range(10)] for _ in range(3)] for _ in range(4)]
line = "
while num > 0:
  b, f, r, v = map(int,input().split())
  building[b-1][f-1][r-1] += v
  num -= 1
for i in range(4):
  for j in range(3):
    building[i][j] = " " + " ".join(map(str,building[i][j]))

for i in range(4):
  [print(j) for j in building[i]]
  if i < 3:
    print(line)

Solution (Python):
from sys import stdin
n = int(stdin.readline())

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

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

for buildingnum in range(4):
    for floornum in range(3):
        print('',*roomlist[buildingnum][floornum])
    if buildingnum != 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("

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

count = [[[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())
    count[b-1][f-1][r-1] += v

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

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


if __name__ == "__main__":
    main()

Solution (Python):
n = int(input())
num = [[[0 for r in range(10)] for f in range(3)] for b in range(4)]

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

for x in range(4):
  for y in range(3):
    for z in range(10):
      print(" "+str(num[x][y][z]),end = "")
    print("")
  if x == 3:
    break
  else:
    print("

Solution (Python):
n = int(input())
dormitory = [[[0 for r in range(10)] for f in range(3)] for b in range(4)]

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

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

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

for j, kousya in enumerate(kousyas):
    for f in kousya:
        for i, r in enumerate(f):
            if i == 9:
                print(f' {r}')
            else:
                print(f' {r}', end='')
    if j <= 2:
        print('

Solution (Python):
n = int(input())
whole_list = []
for b in range(4):
    whole_list.append([])
for b in range(4):
    for f in range(3):
        whole_list[b].append([])
for b in range(4):
    for f in range(3):
        for r in range(10):
            whole_list[b][f].append(0)

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

for b in range(4):
    for f in range(3):
        temp_list = []
        for r in range(10):
            temp_list.append(str(whole_list[b][f][r]))
        print(" " + " ".join(temp_list))
    if b>=0 and b<=2:
        print("

Solution (Python):
house = [[[0 for r in range(10)] for f in range(3)] for b in range(4)]
n = int(input())
for x in range (n):
    b, f, r, v = map(int, input().split())
    house[b - 1][f - 1][r - 1] += v
for b in range(4):
    for f in house[b]:
        print('', *f)
    if b != 3:
        print('

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

t1 = [[0] * 10 for i in range(3)]
t2 = [[0] * 10 for i in range(3)]
t3 = [[0] * 10 for i in range(3)]
t4 = [[0] * 10 for i in range(3)]


def print_t(t):
    for i in t:
        print(" " + " ".join(map(str, i)))


for i in range(n):
    b, f, r, v = map(int, input().split())
    if b == 1:
        t1[f - 1][r - 1] = t1[f - 1][r - 1] + v
    elif b == 2:
        t2[f - 1][r - 1] = t2[f - 1][r - 1] + v
    elif b == 3:
        t3[f - 1][r - 1] = t3[f - 1][r - 1] + v
    elif b == 4:
        t4[f - 1][r - 1] = t4[f - 1][r - 1] + v

print_t(t1)
print("
print_t(t2)
print("
print_t(t3)
print("
print_t(t4)

Solution (Python):
n = int(input())
info = []
Base = []
Result = [['



for ia in range(n):
    val = list(map(int, input().split()))
    info.append(val)


for B in range(1,5):
    for F in range(1,4):
        for R in range(1,11):
            Base.append(list((B, F, R, 0)))

for ib in info:
    b, f, r, v = ib[0], ib[1], ib[2], ib[3]
    for ic in Base:
        if b == ic[0] and f == ic[1] and r == ic[2]:
            ic[3] += v

for ic in Base:
    b1, f1, r1, v1 = ic[0]-1, ic[1]-1, ic[2]-1, ic[3]
    Result[b1*4+f1][r1] = str(v1)
        
for ie, value in enumerate(Result):
    if ie == 3 or ie == 7 or ie == 11:
        print('
    else:
        print(' ' +' '.join(value),end='\n')

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(f' {count[i][j][k]}',end='')
        print()
    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):
table = [[[0 for i in range(10)] for j in range(3)] for k in range(4)]
total = int(input())

for i in range(total):
    B, F, R, V = list(map(int, input().split()))
    table[B - 1][F - 1][R - 1] += V

for i, bldg in enumerate(table):
    if i > 0:
        print("
    for j, flr in enumerate(bldg):
        for k, room in enumerate(flr):
            print(f" {room}", end="")
        print()

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

Solution (Python):
record=[[[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 = [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())
Bs = [0] * 120

for i in range(N):
  b, f, r, v = map(int, input().split())
  if b == 1:
    Bs[0 + 10 * (f-1) + (r-1)] += v
  elif b == 2:
    Bs[30 + 10 * (f-1) + (r-1)] += v
  elif b == 3:
    Bs[60 + 10 * (f-1) + (r-1)] += v
  elif b == 4:
    Bs[90 + 10 * (f-1) + (r-1)] += v

for i in range(12):
  for j in range(10):
    print(' {}'.format(Bs[i * 10 + j]), end = '')
    if (j+1) % 10 == 0:
      print()
  if (i+1) % 3 == 0 and (i+1) != 12:
    print('

Solution (Python):
B = [[0]*30,[0]*30,[0]*30,[0]*30]
n = int(input())

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

for i in [0,1,2,3]:
    print('',*B[i][:10])
    print('',*B[i][10:20])
    print('',*B[i][20:30])
    if i == 3:
        break
    print('

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

for _ in range(n):
  inOut.append(list(map(int, input().split())))

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

for i in range(n):
  num[inOut[i][0]-1][inOut[i][1]-1][inOut[i][2]-1] += inOut[i][3]
      
for i in range(4):
  for j in range(3):
    for k in range(10):
      print(" {}".format(num[i][j][k]), end="")
    print()
  if i != 3:
    print('

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

n = int(input())

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

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

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

z = int(input())

for x in range(z):
    a, b, c, d = map(int, input().split())
    hotel[a - 1][b - 1][c - 1] = hotel[a - 1][b - 1][c - 1] + d

for i, ridge in enumerate(hotel):
    for j, floor in enumerate(ridge):
        for k, room in enumerate(floor):
            print(f" {room}", end="")
        print()
    if i != 3:
        print("

Solution (Python):
n = int(input())
dic = {}

while True:
    try:
        b, f, r, v = map(int, input().split())
        bfr = 100*b + 10*f + r
        if dic.get(str(bfr)) == None:
            dic[str(bfr)] = v
        else:
            dic[str(bfr)] += v
    except:
        break

for b2 in range(1, 5):
    for f2 in range(1, 4):
        l = " "
        for r2 in range(1, 11):
            bfr2 = 100*b2 + 10*f2 + r2
            if dic.get(str(bfr2)) == None:
                l += "0"
            else:
                l += str(dic[str(bfr2)])
            if r2 < 10:
                l += " "
        print(l)
    if b2 < 4:
        print("

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

y = [[[0 for i in range(10)] for v in range(3)] for k in range(4)]

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

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

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

Solution (Python):
n = int(input())
room = [[[0 for i in range(10)],[0 for i in range(10)],[0 for i in range(10)]],
        [[0 for i in range(10)],[0 for i in range(10)],[0 for i in range(10)]],
        [[0 for i in range(10)],[0 for i in range(10)],[0 for i in range(10)]],
        [[0 for i in range(10)],[0 for i in range(10)],[0 for i in range(10)]]]
for i in range(n):
    b, f, r, v = map(int, input().split())
    room[b-1][f-1][r-1] = room[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(room[i][j][k], end="")
        print("")
    if i != 3:
        for l in range(20):
            print("
        print("")

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

for l in range(0,n):
    apart_id,floor,room,human=map(int,input().split())
    apart_table[apart_id-1][floor-1][room-1]+=human

count=0
for m in range(0,4):
    if count!=0:
        print('
    count+=1

    for n in range(0,3):
        for o in range(0,10):
            print(" {}".format(apart_table[m][n][o]),end='')
        print()

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





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

for j in range(0, len(a)):
	for k in range(0, len(a[j])):
		for l in range(0, len(a[j][k])):
			print(' {0}'.format(a[j][k][l]), end='')
		print()
	if j != len(a) - 1:
		print('

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

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

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

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


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


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

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

while i < n:
    l = input()
    l = [x for x in map(int, l.split())]
    tbl[l[0]-1][l[1]-1][l[2]-1] += l[3]
    i += 1

i = 0
for x in tbl:
    for y in x:
        print(" ",end="")
        
        
        
        print(" ".join(map(str, y)))
    if i < 3:
        print("
    i += 1

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

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

for index,build in enumerate(apart) :
    for floor in build:
        for room in floor:
            print(" %d" % room,end="")
        print()
    if index != len(apart)-1:
        print("

Solution (Python):
gakuen_list = [[[0 for i in range(10)]for j in range(3)]for n in range(4)]
y = int(input())
l = 0
for i in range(y):
    a,b,c,x = input().split(" ")
    a = int(a)
    b = int(b)
    c = int(c)
    c -= 1
    q = gakuen_list[a - 1][b - 1][c]
    q = int(q)
    if q != 0:
        q += int(x)
        gakuen_list[a - 1][b- 1][c] = q
    else:
        gakuen_list[a - 1][b- 1][c] = x
        continue
for img in gakuen_list:
    for line in img:
        for dot in line:
            print(" " + str(dot),end="")
        print()
    if l == 3:
        break
    else:
        l += 1
        for n in range(20):
            print("
    print()

Solution (Python):
n = int(input())
B = []
F = []
R = []
V = []
T = [[[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())
    T[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(T[i][j][k], end="")
        print()
    if i < 3:
        print("

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

n = int(input())
newcomer_list = [input() for _ in range(n)]

for newcomer in newcomer_list:
    b, f, r, v = map(int, newcomer.split())
    residence_data[b - 1][f - 1][r - 1] += v

for i in range(4):
    for j in range(3):
        print('', *residence_data[i][j])
    if i == 3:
        break
    print('

Solution (Python):
BUILDGS_COUNT = 4
FLOOR_COUNT = 3
ROOM_COUNT = 10

buildings = [[[0 for i in range(ROOM_COUNT)] for j in range(FLOOR_COUNT)] for k in range(BUILDGS_COUNT)]

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 i in range(BUILDGS_COUNT):
  for j in range(FLOOR_COUNT):
    for k in range(ROOM_COUNT):
      print(' {}'.format(buildings[i][j][k]), end='')
    print()
  if i != BUILDGS_COUNT-1:
    print('

Solution (Python):

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

n = int(input())

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


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"%(house[i][a][b]),end = "")
        print()

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

for i in range(n):
    building, flr, room, val= map(int, input().split())
    rooms[building - 1][flr - 1][room - 1] += val

for i in range(4):
    for ii in range(3):
        fl = str()
        for iii in range(10):
            fl = fl + ' ' + str(rooms[i][ii][iii])
        print(fl)
    if i < 3:
        print('

Solution (Python):
buildings = []
for _ in range(4):
    building = []
    for _ in range(3):
        building.append([0 for _ in range(10)])
    buildings.append(building)

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

for i in range(len(buildings)):
    for floor in buildings[i]:
        print(' ', ' '.join(map(str, floor)), sep='')
    if i != len(buildings)-1:
        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):
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=list(map(int, input().split(" ")))
    
    info[b-1][f-1][r-1]=info[b-1][f-1][r-1]+v

for i,building in enumerate(info):
    if(i):
        print("
    for floor in building:
        for room in floor:
            print(" "+str(room),end="")
        print()