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

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

comp1 = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]
comp2 = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]
comp3 = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]
comp4 = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]
    
for i in range(n):
    b, f, r, v = map(int, input().split())
    if b == 1:
        comp1[f - 1][r - 1] += v
    elif b == 2:
        comp2[f - 1][r - 1] += v
    elif b == 3:
        comp3[f - 1][r - 1] += v
    else:
        comp4[f - 1][r - 1] += v

for s in comp1:
    s = [str(n) for n in s]
    print(' ', end="")
    print(' '.join(s))
print('
for s in comp2:
    s = [str(n) for n in s]
    print(' ', end="")
    print(' '.join(s))
print('
for s in comp3:
    s = [str(n) for n in s]
    print(' ', end="")
    print(' '.join(s))
print('
for s in comp4:
    s = [str(n) for n in s]
    print(' ', end="")
    print(' '.join(s))

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

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

Solution (Python):
import sys
next(sys.stdin)
m = [[[0]*10 for _ in range(3)] for _ in range(4)]
for l in sys.stdin:
    b,f,r,v = map(int, l.split())
    m[b-1][f-1][r-1] += v
for i,b in enumerate(m):
    if i: print('
    for f in b: print('',*f)

Solution (Python):

heya1 = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
         0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
         0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        ]

heya2 = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
         0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
         0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        ]

heya3 = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
         0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
         0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        ]

heya4 = [0, 0, 0, 0, 0, 0, 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):
    x = input()
    list = x.split()
    [b, f, r, v] = list
    b = int(b)
    f = int(f)
    r = int(r)
    v = int(v)
    
    
    f = f - 1
    f = f * 10
    fr = f + r
    fr = fr - 1
    
    
    if b == 1:
        heya = heya1[fr]
        heya = int(heya)
        heya = heya + v
        heya1[fr] = heya
    
    elif b == 2:
        heya = heya2[fr]
        heya = int(heya)
        heya = heya + v
        heya2[fr] = heya
    
    elif b == 3:
        heya = heya3[fr]
        heya = int(heya)
        heya = heya + v
        heya3[fr] = heya

    elif b == 4:
        heya = heya4[fr]
        heya = int(heya)
        heya = heya + v
        heya4[fr] = heya


heya1 = [str(n) for n in heya1]
heya2 = [str(n) for n in heya2]
heya3 = [str(n) for n in heya3]
heya4 = [str(n) for n in heya4]


heya11 = heya1[0:10]
heya12 = heya1[10:20]
heya13 = heya1[20:30]

heya21 = heya2[0:10]
heya22 = heya2[10:20]
heya23 = heya2[20:30]

heya31 = heya3[0:10]
heya32 = heya3[10:20]
heya33 = heya3[20:30]

heya41 = heya4[0:10]
heya42 = heya4[10:20]
heya43 = heya4[20:30]


heya11 = " " + " ".join(heya11)
heya12 = " " + " ".join(heya12)
heya13 = " " + " ".join(heya13)
heya21 = " " + " ".join(heya21)
heya22 = " " + " ".join(heya22)
heya23 = " " + " ".join(heya23)
heya31 = " " + " ".join(heya31)
heya32 = " " + " ".join(heya32)
heya33 = " " + " ".join(heya33)
heya41 = " " + " ".join(heya41)
heya42 = " " + " ".join(heya42)
heya43 = " " + " ".join(heya43)


print(heya11)
print(heya12)
print(heya13)
print("
print(heya21)
print(heya22)
print(heya23)
print("
print(heya31)
print(heya32)
print(heya33)
print("
print(heya41)
print(heya42)
print(heya43)

Solution (Python):
official_house =  [[[ 0 for r in range(10) ] for f in range(3) ]for b in range(4)]
num = int(input())
for i in range(num):
    notice = list(map(int, input().split()))
    b = notice[0]-1
    f = notice[1]-1
    r = notice[2]-1
    official_house[b][f][r] += notice[3]
for b in range(4):
    if b:
        print('
    for f in range(3):
        for r in range(10):
            print('', official_house[b][f][r], end ='')
        print()

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

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

i = 0
for j in c:
    for k in j:
        print('', *k)
    i += 1
    if 0 < i < 4:
        print('

Solution (Python):




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


partition = '


n = int(input())


for info in range(n):
  regident_info = [int(i) for i in input().split()]
  b = regident_info[0] - 1 
  f = regident_info[1] - 1 
  r = regident_info[2] - 1 
  v = regident_info[3] 
  four_buildings[b][f][r] += v


for i, building in enumerate(four_buildings):
  for floor in building:
    str_floor = list(map(str, floor))
    print(' ' + ' '.join(str_floor))
  if i != 3:
    print(partition)

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

list1 = [[0 for k in range(10)] for l in range(3)]
list2 = [[0 for k in range(10)] for l in range(3)]
list3 = [[0 for k in range(10)] for l in range(3)]
list4 = [[0 for k in range(10)] for l in range(3)]


for i in range(n):
    b,f,r,v = 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        
    elif b == 4:
        list4[f-1][r-1] += v

for i in range(3):
    for j in range(10):
        print(' {0}'.format(list1[i][j]),end='')
    print()

print('
for i in range(3):
    for j in range(10):
        print(' {0}'.format(list2[i][j]),end='')
    print()    

print('
for i in range(3):
    for j in range(10):
        print(' {0}'.format(list3[i][j]),end='')
    print()

print('
for i in range(3):
    for j in range(10):
        print(' {0}'.format(list4[i][j]),end='')
    print()

Solution (Python):
floor = []

for i in range(120):
    floor.append(0)

n = int(input())

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

for i in range(4):
    for j in range(3):
        for k in range(10):
            print("", str(floor[30 * (i - 1) + 10 * (j - 1) + (k - 1)]),end="")
        print("")
    if i < 3:
        print("

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

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

for i in range(n):
    house_id,floor,room,add=map(int,input().split())
    table[house_id-1][floor-1][room-1]+=add
    
for i in range(4):
    if i!=0:
        print("
    
    for a in range(3):
        for b in range(10):
            print(" %d"%(table[i][a][b]),end="")
        print()

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

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

Solution (Python):
l = [[[0]*10 for _ in range(3)]for _ in range(4)]
for _ in range(int(input())):
    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):
        print(" " + " ".join(map(str,l[i][j])))
    if i != 3:
        print("

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

N = int(input())

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

for i, building in enumerate(counts):
    for floar in building:
        for room in floar:
            print(" " + str(room), end = "")
        print()
    if i < 3:
        print("

Solution (Python):


"""
Created on Sat Mar  2 15:43:49 2019

@author: mac
"""
n = input()
n = int(n)

numbers = []
index = []

for i in range(12):
    index.append([0, 0, 0, 0, 0, 0, 0, 0, 0, 0])

for _ in range(n):
    string = input()
    numbers.append(list(map(int, string.split(' '))))

numbers.sort()

for i in range(12):
    for j in range(10):
        for k in range(n):
            if (numbers[k][0]-1)*3+(numbers[k][1]-1) == i and (numbers[k][2]-1) == j:
                index[i][j] += numbers[k][3]
                      
for i in range(12):
    for j in range(10):
        print(" ",end="")
        print(index[i][j],end="")


        if i == 12:
            break
        
    print()
        
    if i == 2 or i == 5 or i == 8:
        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

flag = False
for b in count:
    if flag:
        print("
    else:
        flag = True
    for f in b:
        for r in f:
            print(" " + str(r), 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):
    p = input()
    b,f,r,v = map(int, p.split())
    count[b-1][f-1][r-1] = count[b-1][f-1][r-1] + v

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

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

N = int(input())

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

for i, building in enumerate(lst):
    if i > 0:
        print("
    for floor in building:
        for room in floor:
            print(end=" ")
            print(room, end="")
        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):
    B , F , R, V =map(int, input().split())
    table[B - 1][F - 1][R - 1] += V

x = 0

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

    for k in range(3):

        for j in range(10):

            print(" %d" %(table[i][k][j]), end = '')
        print()

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

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

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

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

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


for b in range(1,5):
    for f in range(1,4):
        print(" ",end="")
        print(*num[30*(b-1)+10*(f-1):30*(b-1)+10*(f-1)+10])
    if b <4:
        print("

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

    

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

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

Solution (Python):
rooms = [[[0 for x in range(10)] for x in range(10) ] for x in range(10)]

num = int(input())

for i in range(num):
	b,f,r,v = map(int, input().split())
	rooms[b-1][f-1][r-1] += v 
	
	
	
for l in range(4):
	for j in range(3):
		'''
		for k in range(10):
			print(rooms[l][j][k],end = "")
		'''
		print(" "+" ".join(map(str, rooms[l][j])))
		
	if l != 3:
		print("

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

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

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

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

for i in range(4):
    for j in range(3):
        for k in range(10):
            print(' '+str(ans[i][j][k]), end='')
        print()
    if i != 3:
        print('

Solution (Python):
n = int(input())
list = [0]*120
for i in range(n):
    a,b,c,d = map(int,input().split())
    list[(a-1)*30+(b-1)*10+c-1] += int(d)
for j in range(120):
    print(" {}".format(list[j]),end="")
    if j % 10 == 9:
        print()
    if j % 30 == 29 and j < 90:
        print("

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

for i in range(len(arr)):
    for j in range(len(arr[i])):
        for k in range(len(arr[i][j])):
            print(" %d" % arr[i][j][k],end = "")
        else:
            print("")
    if i < len(arr) -1:
        print('

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

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

i = 0
for house in houses:
  for line in house:
    for num in line:
      print('', num, end = '')
    print()
  if i < 3:
    print('
  i += 1

Solution (Python):
n=int(input())
count=[[[0 for i in range(10)] for j in range(3)] for k in range(4)]
for a in range(n):
    i,j,k,x=map(int,input().split())
    count[i-1][j-1][k-1] += x
for i in range(4):
    for j in range(3):
        for k in count[i][j][:]:
            print(" ",end="")
            print(k,end="")
        print()
    if i<3:
        print("

Solution (Python):
house = [[[0 for i in range(10)] for j in range(3)] for k in range(4)]
n=int(input())
for x in range(n):
    a,b,c,d=map(int,input().split())
    house[a-1][b-1][c-1]+=d
for i in range(4):
    for j in range(3):
        for k in range(10):
            print(f' {house[i][j][k]}',end="")
        print()
    if int(i)<3: print("

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

for i in range(N):
    b, f, r, v = map(int, input().split())
    count[b-1][f-1][r-1] += v
    
for f, k in enumerate(count):
    for j in k:
        for i in j:
            print(" {}".format(i), end="")
        print()
    if f < 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 loop in range(n):
    b,f,r,v = map(int,input().split())
    count[b-1][f-1][r-1] += v

for l in range(4):
    for a in range(3):
        print(" "+" ".join(map(str,count[l][a])))

    if l != 3:
        print("

Solution (Python):
def main():
    n = int(input())
    ans = [[0] * 10 for _ in range(15)]
    for i in range(3, 14, 4):
        ans[i] = '
    for _ in range(n):
        b, f, r, v = map(int, input().split())
        ans[(b - 1) * 4 + f - 1][r - 1] += v
    for col in ans:
        if col.count('
            print(col)
        else:
            print(' ' + ' '.join(map(str, col)))


main()

Solution (Python):

n = int(input())
members = [[[0 for i in range(10)] for j in range(3)] for k in range(4)] 
for i in range(n):
    line = input().rstrip().split()
    members[int(line[0])-1][int(line[1])-1][int(line[2])-1] += int(line[3])

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

Solution (Python):
from collections import defaultdict


data = defaultdict(lambda: defaultdict(lambda: defaultdict(int)))

rows = int(input())

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

for b in range(1, 4+1):
    for f in range(1, 3+1):
        print(' ' + ' '.join(str(data[b][f][r]) for r in range(1, 10+1)))
    if b != 4:
        print('

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

Solution (Python):
n = int(input())
data = {}
for i in range(n):
    b, f, r, v = map(int, input().split())
    if (b,f,r) in data:
        data[(b,f,r)] = data[(b,f,r)] + v
    else:
        data[(b,f,r)] = v
for b in range(1,5):
    for f in range(1,4):
        for r in range(1,11):
            if (b,f,r) in data:
               print(" "+str(data[(b,f,r)]),end="")
            else:
                print(" 0",end="")
        print("")
    if b < 4:
        print("

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

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

  if i != 3:
    print('

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

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

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

while num > 0:
    list = input().split()
    b = int(list[0]) - 1
    f = int(list[1]) - 1
    r = int(list[2]) - 1
    v = int(list[3])
    room[b][f][r] += v 
    num -= 1

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

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

list = []
for x in range(4):
    building = []
    for y in range(3):
        floor = []
        for z in range(10):
            floor.append(0)
        building.append(floor)
    list.append(building)

for x in range(n):
    building, floor, room, num = map(int, input().split())
    list[building - 1][floor - 1][room - 1] += num

flag = False
for building in list:
    if(flag):
        print("
    else:
        flag = True

    for floor in building:
        string = ""
        for room in floor:
            string += " " + str(room)

        print(string)

Solution (Python):
n = int(input())
list_info = [[[0 for i in range(10)] for j in range(3)] for k in range(4)]
for _ in range(n):
    info = input()
    info_list = info.split(" ")
    b = int(info_list[0])
    f = int(info_list[1])
    r = int(info_list[2])
    v = int(info_list[3])
    list_info[b - 1][f - 1][r - 1] += v 
for l in range(4):
    for m in range(3):
        num = ""
        for n in range(10):
            num += " "
            num += str(list_info[l][m][n])
        print(num)
    if not(l == 3):
        print("

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

for number,i in enumerate(bill):
    for n in i:
        for j in n:
            print(" " + str(j),end="")
        print()
    if number != 3: 
        print("
    else:
        break

Solution (Python):
n = int(input())
a = [0]*120
for i in range(n):
	b, f, r, v = map(int, input().split())
	t = (b - 1) * 30 + (f - 1) * 10 + r - 1
	a[t] += v
for i in range(120):
	print(' %d'  % a[i], end="")
	if i % 10 == 9:
		print("")
	if i % 30 == 29 and i < 100:
		for c in range(20):
			print("
		print("")

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

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

school = [[[0 for i3 in range(10)] for i2 in range(3)] for i1 in range(4)]
for i in range(n):
    b, f, r, v = map(int, input().split())
    school[b - 1][f - 1][r - 1] += v

for blg in range(4):
    for flr in range(3):
        for rm in range(10):
            print (" %d" % school[blg][flr][rm], end = "")
        print ()
    if blg < 3:
        print ("

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

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):
h=[[[0]*10for i in[0]*3]for j in[0]*4];i=0
for _ in[0]*int(input()):b,f,r,v=map(int,input().split());h[~-b][~-f][~-r]+=v
for b in h:
 for f in b:print("",*f)
 print(("","

Solution (Python):
section = (1, 2, 3, 4)
book = {sec:[[0 for i in range(10)] for j in range(3)] for sec in section}
n = int(input())
for i in range(n):
    b, f, r, v = map(int, input().split())
    book[b][f - 1][r - 1] += v
for sec in section:
    for rl in book[sec]:
        print(' ' + ' '.join(map(str, rl)))
    if sec != 4:
        print('

Solution (Python):



import sys

tenant = [[[0 for r in range(10)] for f in range(3)] for b in range(4)]

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

ROOM_STR = '{:2}' * 10  
separator = '
for b in range(4):
    for f in range(3):
        print(ROOM_STR.format(*tenant[b][f]))  
    if b != 3:
        print(separator)

Solution (Python):
import sys
arr_3d=[[[0 for r in range(10)] for f in range(3)  ] for b in range (4)]
x=int(sys.stdin.readline())
for i in range(x):
    a,b,c,d=map(int,sys.stdin.readline().split())
    arr_3d[a-1][b-1][c-1]+=d


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

Solution (Python):
building = [[[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 = [int(i) for i in input().split()]
    building[b-1][f-1][r-1] += v
building = [[[" "+str(k) for k in j] for j in i] for i in building]
print("\n

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

for i in range(4):
    for j in x[i]:
        print(' ',end='')
        print(*j)
    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 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):
wall = "

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

N = int(input())

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):
    if i != 0:
        print(wall)
        
    for r in range(3):
        for v in range(10):
            print(" %d"%table[i][r][v],end = "")
        print("")

Solution (Python):
wall = "
L = [[[str(0) for i in range(10)] for i in range(3)]
 for i in range(4)]

N = int(input())
for i in range(N) :
    tou,kai,ban,dx = map(int,input().split())
    L[tou-1][kai-1][ban-1] = str(int(L[tou-1][kai-1][ban-1]) + dx)

for i in range(12) :
    info = " "+" ".join(L[i//3][i%3])
    print(info)
    if i % 3 == 2 and i != 11 :
        print(wall)

Solution (Python):




import math

n = int(input())
room = [[[0 for i in range(10)] for j in range(3)] for z in range(4)]
while(n>0):
    n = n-1
    b,f,r,v = map(int,input().split())
    room[b-1][f-1][r-1] += v

for i in range(4):
    if i != 0:
        print("
    for j in range(3):
        st = ""
        for z in range(10):
            st = st + " " + str(room[i][j][z])
        print(st)

Solution (Python):
import sys

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


def print_rooms():
    for i, building in enumerate(rooms):
        if i != 0:
            print('
        for floor in building:
            print(' ' + ' '.join(map(str, floor)))


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


print_rooms()

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

Solution (Python):
sh = ["
def  bet():
    for i in sh:
        print(i, end="")
    print()

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


n = int(input())
for i in range(n):
    line = input()
    lst = list(map(int, line.split()))
    b = lst[0]
    f = lst[1]
    r = lst[2]
    v = lst[3]
    if b == 1:
        one[f-1][r-1] += v
    elif b == 2:
        two[f-1][r-1] += v
    elif b == 3:
        three[f-1][r-1] += v
    elif b == 4:
        four[f-1][r-1] += v
"""
print(one)
print(two)
print(three)
print(four)

"""
for i in one:
    for j in i:
        print(" {}".format(j), end="")
    print()
bet()
for i in two:
    for j in i:
        print(" {}".format(j), end="")
    print()
bet()
for i in three:
    for j in i:
        print(" {}".format(j), end="")
    print()
bet()
for i in four:
    for j in i:
        print(" {}".format(j), end="")
    print()

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

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

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

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

Solution (Python):
from collections import defaultdict
residents = defaultdict(int)
n=int(input())
q = [map(int, input().split()) for _ in range(n)]
for b, f, r, v in q:
    residents[(b,f,r)] += v
print(f'\n{"

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

n = int(input())

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

for i, j in enumerate(a):
    for k in j:
        for l in k:
            print(' ' + str(l), end='')
        print()
    if i < len(a) - 1:
        print('

Solution (Python):
def main():
	buillist = [Building(), Building(), Building(), Building()]
	n = int(input())
	for i in range(n):
		x = input().split()
		buillist[int(x[0]) - 1].assign(int(x[1]), int(x[2]), int(x[3]))
	for b in range(4):
		for f in range(3):
			string = map(str, buillist[b].floors[f])
			string = ' '.join(string)
			buillist[b].string[f] = string
		for f in buillist[b].string:
			print(' ' + f)
		if not b == 3:
			print('

class Building():
	def __init__(self):
		self.floors = [[0]*10, [0]*10, [0]*10]
		self.string = ['', '', '']

	def assign(self, f, r, v):
		self.floors[f - 1][r - 1] += v

main()