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

i = 0
l = 0
num = 0
a = []
n = int(input())

while i<n:
    a.append(list(map(int, input().split())))
    i += 1

for i in range(4):
    for j in range(3):
        for k in range(10):
            result = False
            l = 0
            num = 0
            while l < n:
                if i + 1 == a[l][0] and j + 1 == a[l][1] and k + 1 == a[l][2]:
                    num += a[l][3]
                l += 1
            
            print(" %s" % num, end="")
            
            
            
            
            
            if k == 9:
                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):
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):
room = [[[],[],[]],[[],[],[]],[[],[],[]],[[],[],[]]]
for i in range(4):
    for j in range(3):
        for k in range(10):
            room[i][j].append(0)
n = int(input())
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):
        print(" "+" ".join(map(str, room[i][j])))
    if i != 3: print("

Solution (Python):
import sys
count = [[[0 for r in range(10)] for f in range(3)] for b in range(4)]
n = int(sys.stdin.readline().strip())

for _ in range(n):
    array = sys.stdin.readline().strip().split(' ')
    b, f, r, v = [int(i) for i in array]
    count[b-1][f-1][r-1] += v
for b in range(4):
    for f in range(3):
        for r in range(10):
            print(' %d' % count[b][f][r], end='')
        print()
    if b != 3:
        print('

Solution (Python):
array = [[[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())
    array[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(" " + str(array[i][j][k]), end="")
            if k == 9:
                print(" " + str(array[i][j][k]))
    if i < 3:
        print("

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

list = [[[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())

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

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

Solution (Python):


def main():
    n = int(input())
    input_bulding_datas=[]
    input_bulding_datas=[[int(i) for i in input().split()] for _ in range(n)]

    all_buldings=[]
    for i in range(4):
        floors=[]
        buldings=[]
        for j in range(3):
            floors+=[[0]*10]
        buldings+=floors
        all_buldings+=[buldings]

    for input_floor_datas in input_bulding_datas:
            b,f,r,v=input_floor_datas
            all_buldings[b-1][f-1][r-1]+=v

    print_string=""
    for idx,bulding_data in enumerate(all_buldings):
        for floor_data in bulding_data:
            for data in floor_data:
                print_string+=" "+str(data)
            print(print_string)
            print_string=""
        if idx!=3:
            print("



if __name__=="__main__":
    main()

Solution (Python):
res_list = [[[0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]],
            [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]],
            [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]],
            [[0, 0, 0, 0, 0, 0, 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):
    io_rec = list(map(int, input().split(" ")))
    bld_num = io_rec[0] - 1
    floor_num = io_rec[1] - 1
    room_num = io_rec[2] - 1
    io_headcnt = io_rec[3]
    res_list[bld_num][floor_num][room_num] += io_headcnt


for i in range(4):
    if i:
        print("
    bld = res_list[i]
    for j in bld:
        floor_str = map(str, j)
        print(" " + " ".join(floor_str))

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):
_, *lines = open(0).readlines()
H = [[[0]*10 for i in range(3)] for j in range(4)]
for line in lines:
    b, f, r, v = map(int, line.split())
    H[b-1][f-1][r-1] += v
for i, h in enumerate(H):
    if i:
        print("
    for r in h:
        print("",*r)

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

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

for building in range(len(rooms)):
    for floor in rooms[building]:
        str_f = map(lambda s: str(s), floor)
        str_f = " ".join(str_f)
        print("", end = " ")
        print(str_f)
    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("

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

list = [[[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())

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

for b in range(4):
    for f in range(3):
        print("", ' '.join(map(str, list[b][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):
        for k in range(10):
            print(f' {count[i][j][k]}',end='')
        print()
    if i < 3:
        print('

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

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

for num in nums:
    count[num[0] - 1][num[1] - 1][num[2] - 1] += num[3]

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

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

Solution (Python):
l = [[[0 for i in range(10)] for j in range(3)] for k in range(4)]
n = int(input())
a = [[int(i) for i in input().split()] for _ in range(n)]
for i in a:
    l[i[0] - 1][i[1] - 1][i[2] - 1] += i[3]
for i in range(len(l)):
    for j in l[i]:
        print(''.join(map(lambda x: ' ' + str(x), j)))
    if 0 <= i <= len(l) - 2:
        print('

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

for i, b in enumerate(h):
  for f in b:
    for r in f:
      print(" {}".format(r),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):
import copy
n = int(input())
list0 = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
list1 = [copy.copy(list0), copy.copy(list0), copy.copy(list0)]
list2 = [copy.copy(list0), copy.copy(list0), copy.copy(list0)]
list3 = [copy.copy(list0), copy.copy(list0), copy.copy(list0)]
list4 = [copy.copy(list0), copy.copy(list0), copy.copy(list0)]
for i in range(n):  
  b, f, r, v = list(map(int, input().split()))
  if b == 1:
    list1[f-1][r-1] += v
  elif b == 2:
    list2[f-1][r-1] += v
  elif b == 3:
    list3[f-1][r-1] += v
  else:
    list4[f-1][r-1] += v
for j in range(3):
  print(" " + " ".join((list(map(str, list1[j])))))
print("
for j in range(3):
  print(" " +" ".join((list(map(str, list2[j])))))
print("
for j in range(3):
  print(" " + " ".join((list(map(str, list3[j])))))
print("
for j in range(3):
  print(" " + " ".join((list(map(str, list4[j])))))

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


for i in range(4) :
    for j in range(3):
        print(end = " ")
        print(*room[i][j])
    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):
n = int(input())
a = [[[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())
    a[b-1][f-1][r-1] += v

for i in range(4):
    for j in range(3):
        l = a[i][j]
        print(' ' + ' '.join(map(str, l)))
    if i < 3:
        print("

Solution (Python):
N = int(input())
B = 4
F = 3
R = 10
dp = [0] * B * F * R

for i in range(N):
    b, f, r, v = [int(n) for n in input().split()]
    dp[(b-1)*F*R+(f-1)*R+(r-1)] += v
for i in range(B):
    for j in range(F):
        print(' ', end='')
        print(*dp[i*F*R+j*R:i*F*R+j*R+R])
    if i<B-1: print('

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

n = int(input())

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


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

Solution (Python):
_, *lines = open(0).readlines()
H = [[[0]*10 for i in range(3)] for j in range(4)]
for line in lines:
    b, f, r, v = map(int, line.split())
    H[b-1][f-1][r-1] += v
for i, h in enumerate(H):
    if i:
        print("
    for r in h:
        print("",*r)

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):
all = [[[0]*10 for q in range(3)] for w in range (4)]
a = int(input())
for m in range(a):
    s,d,f,g = map(int, input().split(' '))
    all[s-1][d-1][f-1] = all[s-1][d-1][f-1] + g
for i in range(4):
    for j in range(3):
        for n in range(10):
            print(' ' + str(all[i][j][n]),end='')
        print()
    if i == 0 or i == 1 or i == 2:
        print('

Solution (Python):
n = int(input())
a = [0 for i in range(120)]

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):
  print(_,*a[i*30:i*30+10])
  print(_,*a[i*30+10:i*30+20])
  print(_,*a[i*30+20:i*30+30])
  if i != 3:
    print('

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

for i, building in enumerate(buildings):
    for floor in building:
        print(" ",end='')
        print(" ".join(map(str,floor)))
    if i != 3:
        print("

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

n_room = 10
n_floor = 3
n_building = 4
room_info = [[[0 for _ in range(n_room)] for _ in range(n_floor)] for _ in range(n_building)]

for _ in range(n):
    
    b, f, r, v = map(int, input().split(" "))
    room_info[b - 1][f - 1][r - 1] += v
    
checker = 0
for building_info in room_info:
    if checker != 0:
        print("
    for floor_info in building_info:
        for room_info in floor_info:
            print(f" {room_info}", end="")
        print()
    checker += 1

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

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

Solution (Python):
datemax = int(input())
count = [[[0 for i in range(10)] for j in range(3)] for k in range(4)]
for l in range(datemax):
    k,j,i,v = [int(x) for x in input().split()]
    count[k - 1][j - 1][i - 1] += v
for k in range(4):
    for j in count[k]:
        print(" "+" ".join([str(x) for x in j]))
    if k != 3:
        print("".join(["

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

x = 0
for b in range(4):
    if x != 0:
        print('
    x += 1
    for f in range(3):
        for r in range(10):
            print(' {}'.format(public_office[b][f][r]), end='')
        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):
n = int(input())
to1 = [[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0]]
to2 = [[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0]]
to3 = [[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0]]
to4 = [[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0]]

tolist = [to1,to2,to3,to4]

for i in range(n):
    to,kai,heya,hito = map(int,input().split(" "))
    tolist[to-1][kai-1][heya-1] += hito

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

Solution (Python):
n = int(input())
tran = [list(map(int, input().split())) for i in range(n)]
house_list = [[[0] * 10 for i in range(3)] for j in range(4)]

for x in range(n):
    b = tran[x][0] - 1
    f = tran[x][1] - 1
    r = tran[x][2] - 1
    house_list[b][f][r] += tran[x][3]

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

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

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

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

for s, k in enumerate(tbl):
    for j in k:
        for i in j:
            print(f' {i}', end='')
        print()
    if s == len(tbl)-1:
        continue
    print('

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

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

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

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

Solution (Python):
bfr = [[[0] * 10 for _ in range(3)] for _ in range(4)]
sep = '

n = int(input())

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

for i, b in enumerate(bfr):
    for f in b:
        for r in f:
            print(f' {r}', end='')
        print()
    if i != 3:
        print(sep)

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

n = int(input())

efrv = [map(int, input().split()) for _ in range(n)]
e, f, r, v = [list(i) for i in zip(*efrv)]

for num in range(n):
    if e[num] == 1:
        a[f[num]-1][r[num]-1] += v[num]
    elif e[num] == 2:
        b[f[num]-1][r[num]-1] += v[num]
    elif e[num] == 3:
        c[f[num]-1][r[num]-1] += v[num]
    elif e[num] == 4:
        d[f[num]-1][r[num]-1] += v[num]


for fl in a:
    print(" ",end="")
    print(*fl)
print("
for fl in b:
    print(" ",end="")
    print(*fl)
print("
for fl in c:
    print(" ",end="")
    print(*fl)
print("
for fl in d:
    print(" ",end="")
    print(*fl)

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

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

for b in range(4):
    if b > 0 and b < 4:
        print("
    for f in range(3):
        line = ""
        for r in range(10):
            v = buildings[b][f][r]
            line += " " + str(v)
        print(line)

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

for i in range(N):
  b,f,r,v = map(int,input().split())
  rooms[b-1][f-1][r-1] += v
  if rooms[b-1][f-1][r-1] < 0:
    rooms[b-1][f-1][r-1] = 0
  elif rooms[b-1][f-1][r-1] > 9:
    rooms[b-1][f-1][r-1] = 9
  
for i in range(4):
  for j in range(3):
    for k in range(10):
    
        if k == 0:
          print(" "+ str(rooms[i][j][k]),end =" ") 
        elif k == 9:
          print(rooms[i][j][k],end ="")
        else:
          print(rooms[i][j][k],end =" ")  
    
    print()
  if i != 3:
    print("

Solution (Python):
N = int(input())
apartment = [[0 for i in range(20)] for j in range(15)]
for n in range (N):
    b,f,r,v = map(int,input().split())
    apartment[4*(b-1)+f-1][r*2-1] += v 
for y in range(15):
    for x in range(20):
        if(y%4==3):
            apartment[y][x]='
        elif x%2==0 :
            apartment[y][x]=' '
        print(apartment[y][x],end='')
    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(f' {house[i][j][k]}', end="")
        print()
    if i != 3:
        print("

Solution (Python):
import sys

input = sys.stdin.readline

def main():
    s = [
        [[0,0,0,0,0,0,0,0,0,0],
        [0,0,0,0,0,0,0,0,0,0],
        [0,0,0,0,0,0,0,0,0,0]],
        
        [[0,0,0,0,0,0,0,0,0,0],
        [0,0,0,0,0,0,0,0,0,0],
        [0,0,0,0,0,0,0,0,0,0]],
        
        [[0,0,0,0,0,0,0,0,0,0],
        [0,0,0,0,0,0,0,0,0,0],
        [0,0,0,0,0,0,0,0,0,0]],
        
        [[0,0,0,0,0,0,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):
        a,b,c,f = map(int, input().split())
        if 0 <= s[a-1][b-1][c-1] + f <=9:
            s[a-1][b-1][c-1] += f
        
    for i in range(4):
        for k in range(3):
            print(" ", end="")
            print(*s[i][k])
        if i != 3:
            print("

if __name__ == "__main__":
    main()

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

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

cnt = 0

FF =[b1,b2,b3,b4]

for i in range(n):
    b,f,r,v = map(int,input().split())
    if b == 1:
        b1[f-1][r-1] += v
    elif b == 2:
        b2[f-1][r-1] += v
    elif b == 3:
        b3[f-1][r-1] += v
    else:
        b4[f-1][r-1] += v
for k in FF:
    for i in range(3):
        for j in range(10):
            print("",k[i][j],end="")
        print()
    if cnt < 3:
        print('
        cnt += 1

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

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


N = int(input())


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

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())
l=[]
for i in range(n):
	b,f,r,v=[int(x) for x in input().split()]
	l.append([b,f,r,v])


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


for i in l:
	b,f,r,v=i[0],i[1],i[2],i[3]
	count[b-1][f-1][r-1] += v


for s,m in enumerate(count):
	for n in m:
		for o in n:
			print(f" {o}",end="")
		print()
	if s<3:
		print("

Solution (Python):

        
        
class Building:
    def __init__(self,max_floor,max_room):
        self.max_floor=max_floor
        self.max_room=max_room
        
        row=max_floor
        col=max_room
        self.room_info=[[0 for j in range(col)] for i in range(row)]
        
    def update_visited(self,f,r,v):
        self.room_info[f][r]+=v
        

class OfficialHouse:
    def __init__(self,max_building=4,max_floor=3,max_room=10):
        self.buildings=[]
        for building_id in range(max_building):
            self.buildings.append(Building(max_floor=max_floor,max_room=max_room))
            
    def update_visited(self,notice):
        
        
        b=notice.building_id-1
        f=notice.floor-1
        r=notice.room_number-1
        v=notice.visited_number
        self.buildings[b].update_visited(f,r,v)
        

    def print_official_house_info(self):
        b_max=len(self.buildings)
        f_max=self.buildings[0].max_floor
        r_max=self.buildings[0].max_room
        
        for b in range(b_max):
            for f in range(f_max):
                for r in range(r_max):
                    v=self.buildings[b].room_info[f][r]
                    print(f" {v}",end="")
                print("")
            if b != b_max-1:
                print("
        

class Notice:
    def __init__(self,building_id,floor,room_number,visited_number):
        self.building_id=building_id
        self.floor=floor
        self.room_number=room_number
        self.visited_number=visited_number


def tell_notice(notice_list,house):
    for notice in notice_list:
        house.update_visited(notice)


def input_notice():
    n=int(input())
    
    notice_list=[]
    
    for i in range(n):
        b,f,r,v=tuple(map(int,input().split()))
    
        notice=Notice(building_id=b,floor=f,room_number=r,visited_number=v)
        
        notice_list.append(notice)

        
    return notice_list
    
    
def exe_notice():
    notice_ls=input_notice()
    
    house=OfficialHouse()
    
    tell_notice(notice_ls,house)
    
    house.print_official_house_info()



exe_notice()

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):
building = [[[0 for i in range(10)] for j in range(3)] for k in range(4)]

n = int(input())
x = [list(map(int,input().split())) for _ in range(n)]

for i in range(len(x)):
    b = x[i][0]-1
    f = x[i][1]-1
    r = x[i][2]-1
    v = x[i][3]
    building[b][f][r] += v

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

Solution (Python):
count=[[[0 for k in range(10)] for j in range(3)] for i in range(4)]
n=int(input())
for elem 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):
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())
    rooms[b-1][f-1][r-1] += v

for i in range(4):
    for j in range(3):
        print(' ', end='')
        print(' '.join(map(str, rooms[i][j])))
    if i < 3:
        print('

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

Solution (Python):
n = int(input())
data = [map(int, input().split()) for i in range(n)]
ans = [[[0 for r in range(10)] for f in range(3)] for b in range(4)]
for b,f,r,v in data:
    ans[b-1][f-1][r-1] += v
    
ans = [[[' '+str(ans[b][f][r]) for r in range(10)] for f in range(3)] for b in range(4)]
for b in range(4):
    for f in range(3):
        ans_str = ''.join(ans[b][f])
        print(ans_str)
    if b<3:
        print('

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

house = [[[0] * 10 for _ in range(3)] for _ in range(4)]
for _ in range(n):
    a = input()
    b, f, r, v = map(int, a.split())
    house[b - 1][f - 1][r - 1] += v
    if house[b - 1][f - 1][r -1] < 0:
        house[b - 1][f-1][r-1] = 0
    elif house[b - 1][f-1][r-1] >= 10:
        house[b - 1][f-1][r-1] = 9


for i in range(len(house)):
    for j in house[i]:
        word=''
        for k in range(10):
            word += ' ' + str(j[k])
        print(word)
    if i + 1 == len(house):
        pass
    else:
        print('

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

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

cnt = 1

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

for bb in range(4):
    for ff in range(3):
        for rr in range(10):
            print(" {}".format(A[bb][ff][rr]), end="")
        print("")
    if bb != 3:
        print("

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

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


for i, b in enumerate(room):
    for f in b:
        for r in f:
            print(" {}".format(r),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):
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):
l=[[[0 for i in range(10)] for i in range(3)] for i in range(4)]
n=int(input())
for i in range(n):
    a,b,c,d=input().split()
    l[int(a)-1][int(b)-1][int(c)-1]+=int(d)
for i in range(120):
    print('',l[i//30][i%30//10][i%10],end='')
    if (i+1)%10==0:print()
    if (i+1)%30==0 and i!=119:print('

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

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

Solution (Python):
build = []
each1 = []
each2 = []
each3 = []
each4 = []


for i in range(30):
    each1.append(0)
    each2.append(0)
    each3.append(0)
    each4.append(0)

build.append(each1)
build.append(each2)
build.append(each3)
build.append(each4)


n = int(input())

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


for i in range(4):
    for j in range(3):
        for k in range(10):
            print(" %d" %build[i][j*10+k],end="")
        print()
    if i !=3:
        print(20*"