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())
info=[input().split() for i in range(n)]

A=[[['',0,0,0,0,0,0,0,0,0,0] for i in range(3)]for j in range(4)]

for new in info:
    A[int(new[0])-1][int(new[1])-1][int(new[2])]+=int(new[3])

for j in range(4):
    for k in A[j]:
        print(*k)
    if j < 3:print('

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

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


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

for b in range(4):
    for f in range(3):
        print(" ", end="")
        print(" ".join(map(str, bldgs[b][f])))
    if b != 3:
        print("

Solution (Python):


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

Solution (Python):
n=int(input())
ds=[]
for b in range(4):
    ds.append([])
    for f in range(3):
        ds[b].append([])
        for r in range(10):
            ds[b][f].append(0)
for i in range(n):
    txt=input().split()
    for num,v in enumerate(txt):
        txt[num]=int(v)
    ds[txt[0]-1][txt[1]-1][txt[2]-1]+=txt[3]
for b in range(4):
    if b>=1:
        print('
    for f in range(3):
        txt=''
        for r in range(10):
            txt+=' '+str(ds[b][f][r])
        print(txt)

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

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

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

for i in range(info):
    b, f, r, v = [int(i) for i in input().split()]
    dormitory[b-1][f-1][r-1] += v
    
for i, b in enumerate(dormitory):
    for f in b:
        for r in f:
            print(' '+str(r), end="")
        print()
    if i != 3:
        print('

Solution (Python):
building1 = [[0] * 10, [0] * 10, [0] * 10]
building2 = [[0] * 10, [0] * 10, [0] * 10]
building3 = [[0] * 10, [0] * 10, [0] * 10]
building4 = [[0] * 10, [0] * 10, [0] * 10]
all_building = [building1, building2, building3, building4]
separator = '


def int_decre(str_num):
    return int(str_num) - 1


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

for j in range(4):
    for i in range(3):
        print(' {0[0]} {0[1]} {0[2]} {0[3]} {0[4]} {0[5]} {0[6]} {0[7]} {0[8]} {0[9]}'.format(all_building[j][i]))
    if j == 3:
        pass
    else:
        print(separator)

Solution (Python):

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

for i in range(4):
    for j in range(3):
        for k in range(10):
            print(f" {a[i][j][k]}",end = "")
        print()
    if i < 3:
        print("
    else:
        pass

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

for i in range(0,len(house)):
    for j in range(0, len(house[i])):
        print(' '+' '.join(map(str,house[i][j])))
    if (i<len(house)-1):
        print('

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

for tou in date:
    for floor in tou:
        for room in floor:
            print("", room, end = "")
        print()
    if t != 3:
        t += 1
        print("

Solution (Python):
n = int(input())
one_one = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
one_two = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
one_three = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
two_one = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
two_two = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
two_three = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
three_one = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
three_two = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
three_three = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
four_one = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
four_two = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
four_three = [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:
        if f == 1:
            one_one[r-1] += v
        elif f == 2:
            one_two[r-1] += v
        elif f == 3:
            one_three[r-1] += v
    if b == 2:
        if f == 1:
            two_one[r-1] += v
        elif f == 2:
            two_two[r-1] += v
        elif f == 3:
            two_three[r-1] += v
    if b == 3:
        if f == 1:
            three_one[r-1] += v
        elif f == 2:
            three_two[r-1] += v
        elif f == 3:
            three_three[r-1] += v
    if b == 4:
        if f == 1:
            four_one[r-1] += v
        elif f == 2:
            four_two[r-1] += v
        elif f == 3:
            four_three[r-1] += v
print(" ",end="")
print(" ".join(map(str, one_one)))
print(" ",end="")
print(" ".join(map(str, one_two)))
print(" ",end="")
print(" ".join(map(str, one_three)))
print("
print(" ",end="")
print(" ".join(map(str, two_one)))
print(" ",end="")
print(" ".join(map(str, two_two)))
print(" ",end="")
print(" ".join(map(str, two_three)))
print("
print(" ",end="")
print(" ".join(map(str, three_one)))
print(" ",end="")
print(" ".join(map(str, three_two)))
print(" ",end="")
print(" ".join(map(str, three_three)))
print("
print(" ",end="")
print(" ".join(map(str, four_one)))
print(" ",end="")
print(" ".join(map(str, four_two)))
print(" ",end="")
print(" ".join(map(str, four_three)))

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

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

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

Solution (Python):

n=int(input())

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

for m in range(n):
    house,floor,room,mem=map(int,input().split())
    
    l[house-1][floor-1][room-1]+=mem
    
for o in range(4):
    if o is not 0:
        print("
    for p in range(3):
        for q in range(10):
            print(" %d"%(l[o][p][q]),end = "")
        print()

Solution (Python):
count = [[[0 for i in range(11)] for j in range(4)] for k in range(5)]

N = int(input())

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

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

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

buildings = [[[0 for x in range(10)] for y in range(3)] for z in range(4)]

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

for x in range(4):
    for floor in buildings[x]:
        print("", *floor)
    if x != 3:
        print("

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

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

Solution (Python):
def buildmake(building) :
    for i in range(3):
        iroom = str(i) + "room"
        iroom = list()
        for j in range(10):
            iroom.append(0)
        building.append(iroom)
    buildings.append(building)

def showroom(floor):
    roomline = str()
    for s in floor:
        roomline += " " + str(s)
    print(roomline)

buildings = list()
building1 = list()
building2 = list()
building3 = list()
building4 = list()

buildmake(building1)
buildmake(building2)
buildmake(building3)
buildmake(building4)

n = int(input())

for i in range(n):
      b,f,r,v = map(int,input().split())
      buildings[b-1][f-1][r-1] += v
      
buildcount = 0
for building in buildings:
    
    for floor in building:
        showroom(floor)
  
    if buildcount == len(buildings) - 1:
        break
    else:
        buildcount += 1
        print("

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

for _ in range(n):
	b, f, r, v = map(int, input().split())

	people.setdefault(b, {})
	people[b].setdefault(f, {})
	people[b][f].setdefault(r, 0)

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

for b in range(1, 5):
	for f in range(1, 4):
		for r in range(1, 11):
			if people.get(b):
				if people[b].get(f):
					p = people[b][f][r] if people[b][f].get(r) else 0
				else:
					p = 0
			else:
				p = 0

			print(' {}'.format(p), end='')
		print('\n', end='')
	if b < 4:
		print('

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

for i in range(len(table)):
    for  j in range(len(table[i])):
        for k in range(len(table[i][j])):
            print(' %d' %(table[i][j][k]), end = '')
        print('')
    if i != len(table) - 1:
        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):
n=int(input())
tbl=[[[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())
    tbl[b-1][f-1][r-1]+=v
for i in range(4):
    for j in range(3):
        print("",*tbl[i][j])
    if 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())
kugiri_ck=0

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

for building in count:
    if kugiri_ck!=0:
        print("
    kugiri_ck+=1
    
    for floor in building:
        for room in floor:
            print('{:>2}'.format(room),end="")
        print()

Solution (Python):
num_floors = 3
num_rooms = 10
num_houses = 4
houses = {house: [[0 for room in range(num_rooms)] for floor in range(num_floors)] for house in range(1, num_houses+1)}

num_moves = int(input())

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

for i in range(1, num_houses+1):
    for j in houses[i]:
        for k in j:
            print(' {:d}'.format(k), end='')
        print()
    if not i == num_houses:
        print('

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

Solution (Python):

n = int(input())
moves = []
for a in range(n):
    moves.append(list(map(int, input().split())))


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


for move in moves:
    apt[move[0]-1][move[1]-1][move[2]-1] += move[3]


for x in range(3):
    for y in range(3):
        for z in range(10):
            print(' {}'.format(apt[x][y][z]), end='')
        print()
    wall = '
    print(wall)
for b in range(3):
    for c in range(10):
        print(' {}'.format(apt[3][b][c]), end='')
    print()

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

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

Solution (Python):
import copy
floor = [0 for i in range(10)]
building = [floor.copy(), floor.copy(), floor.copy()]
buildings = [[], [], [], []]
for i in range(4):
    buildings[i] = copy.deepcopy(building)


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


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

Solution (Python):
a = [[[0] * 10 for _ in range(3)] for _ in range(4)]
for _ in range(int(input())):
    b, f, r, v = [int(i) for i in input().split()]
    a[b - 1][f - 1][r - 1] += v
for i in a:
    for j in i:
        print("", *j)
    if i is a[-1]:
        break
    print("

Solution (Python):
a = [[[0 for room in range(10)] for floor in range(3)] for house in range(4)]
N = int(input())
for i in range(N):
    h, f, r, v = map(int, input().split())
    a[h - 1][f - 1][r - 1] += v


for h in range(4):
    for f in range(3):
        print(' ' + ' '.join([str(x) for x in a[h][f]]))
    if not h == 3:
        print('

Solution (Python):
res=[[[0 for r in range(10)]for f in range(3)]for b in range(4)]
for i in range(int(input())):
    b,f,r,v=map(int,input().split())

    res[b-1][f-1][r-1]+=v
for b in range(4):
    for f in range(3):
        for r in range(10):
            print(' ',res[b][f][r],sep='',end='')
        print()
    if b < 3:
        print('

Solution (Python):
A,B,C,D = [],[],[],[]


for j in range(3):
    A.append([0,0,0,0,0,0,0,0,0,0])
    B.append([0,0,0,0,0,0,0,0,0,0])
    C.append([0,0,0,0,0,0,0,0,0,0])
    D.append([0,0,0,0,0,0,0,0,0,0])


n = int(input())
  

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

line = "

for i in A:
    for k in i:
        print("",k,end ="")
    print()

print(line)
for i in B:
    for k in i:
        print("",k,end ="")
    print()
print(line)
for i in C:
    for k in i:
        print("",k,end ="")
    print()
print(line)
for i in D:
    for k in i:
        print("",k,end ="")
    print()

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

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

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

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

Solution (Python):
HOUSE_CNT = 4
FLOOR_CNT = 3
ROOM_CNT = 10

def init(houses):
    for h in range(0, HOUSE_CNT):
        floors = []
        for f in range(0, FLOOR_CNT):
            rooms = []
            for r in range(0, ROOM_CNT):
                rooms.append(0)
            floors.append(rooms)
        houses.append(floors)


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


def output(houses):
    line = False
    for house in houses:
        if line:
            print('
        else:
            line = True
        for floor in house:
            for room in floor:
                print(' %d' % room, end='')
            print()


houses = []
init(houses)
in_out(houses)
output(houses)

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

n = int(input())

for _ in range(n):
    a = [int(x) for x in input().split()]
    A[3*(a[0]-1)+a[1]-1][a[2]-1] += a[3]

for _ in range(12):
    for i in range(0,10):
        print(" ", end="")
        print(A[_][i],end="")
    print()
    count += 1
    if count >= 3 and not _ == 11:
        count = 0
        print("
        continue

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

for i in range(4):
    if i > 0:
        print('
    for j in range(3):
        rooms[i][j][0] = ' ' + str(rooms[i][j][0])
        print(*rooms[i][j])

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 j in range(3):
        print(" %s" % " ".join(map(str, table[i][j])))
    if i < 3:
        print("

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

A = [[[0 for r in range(10)] for f in range(3)] for b in range(4)]
for b, f, r, v in X:
    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):
p = [[[0 for z in range(10)] for y in range(3)] for x in range(4)]

num = int(input())

for i in range(num):
    b,f,r,v = [ int(x) for x in input().split()]
    p[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(p[i][j][k],end="")
        print()
    if i < 3:
        print("

Solution (Python):
bn = 4
fn = 3
rn = 10
room = [0]*bn*fn*rn

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

for b in range(1, bn+1):
    for f in range(1, fn+1):
        for r in range(1, rn+1):
            num = (b-1)*fn*rn + (f-1)*rn + (r-1)
            print(' %d' % room[num], end='')
        print()
    if b < bn:print('

Solution (Python):


rooms = [[0 for i in range(10)] for j in range(12)]
n = int(input())
for i in range(n):
    b, f, r, v = map(int, input().split())
    b -= 1
    f -= 1
    r -= 1
    rooms[b * 3 + f][r] += v
for i in range(12):
    if i > 0 and i % 3 == 0:
        print('
    for j in range(10):
        print(' %d' % rooms[i][j], end = '')
    print('')

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

Office1 = [[0 for i in range(10)] for j in range(3)]
Office2 = [[0 for i in range(10)] for j in range(3)]
Office3 = [[0 for i in range(10)] for j in range(3)]
Office4 = [[0 for i in range(10)] for j in range(3)]

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

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

    if b==1:
        Office1[f-1][r-1]+=v
    if b==2:
        Office2[f-1][r-1]+=v
    if b==3:
        Office3[f-1][r-1]+=v
    if b==4:
        Office4[f-1][r-1]+=v
    
str = "
printfunc(Office1)
print(str)
printfunc(Office2)
print(str)
printfunc(Office3)
print(str)
printfunc(Office4)

Solution (Python):
def test():

	output = [[0 for i in range(10)] for j in range(12)]

	n = int(input())

	for num in range(n):
		
		inputs = list(map(int,input().split()))

		b = inputs[0] - 1
		f = inputs[1] - 1
		r = inputs[2] - 1
		v = inputs[3]

		output[b*3 + f][r] += v


	for i in range(12):
		for j in range(10):
			print(f" {output[i][j]}",end = '')
		print()
		if i % 3 == 2 and i != 11:
			for j in range(20):
				print("
			print()


if __name__ == "__main__":
	test()

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

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

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

for i in range(0,len(bld),10):
    if i % 30 == 0 and i > 0:
        print("
    print(" " + " ".join(map(str,bld[i:i+10])))

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(12):
    seq=a[10*i:10*i+10]
    print(" "+" ".join(map(str,seq)))
    if i%3==2 and i!=11:
        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):
A =[[[0 for i in range(10)] for j in range(3)] for k in range(4)]

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

Solution (Python):
n=int(raw_input())
a=[[0 for x in range(10)] for x in range(12)]


for i in range(n):
	b,f,r,v=map(int,raw_input().split())
	a[b*3+f-4][r-1] += v
for i in range(12):
	print " "+" ".join(map(str,a[i]))
	if i==2 or i==5 or i==8:
		print "

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

for j in range(4):
    for k in range(3):
        print(' '+' '.join(str(i) for i in room[j][k]))
    if j<3:
        print('

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

Solution (Python):
n = int(input())
a = [[[0]*11 for j in range(4)]for k in range(5)]
for i in range(0, n):
    b, f, r, v = map(int, input().split())
    a[b][f][r] += v


for i in range(1, 5):
    for j in range(1, 4):
        for k in range(1, 11):
            print(" %d" % (a[i][j][k]), end="")
        print()
    if not i == 4:
        print('

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

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

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

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

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

Solution (Python):

a = int(input())
building = [[[0 for zero in range(10)] for floor in range(3)] for room in range(4)]


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

for j in range(4):
    for k in range(4):
        if k == 3:
            if j != 3:
                print('
            else:
                break
        else:
            print(' ' + ' '.join([str(building[j][k][n]) for n in range(10)]))

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):
    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(" ", room[i][j][k], sep="", end="")
        print("")
    if i <= 2:
        split_str="
        print(split_str)

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

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

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

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

A=[[[0 for k in range(11)] for j in range(4)] for i in range(5)]

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

for a in range(1,5):
	for b in range(1,4):
		for c in range(1,11):
			print(f" {A[a][b][c]}", end="")
		print()
	if a != 4: print("

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

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

Solution (Python):
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())
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):
import sys,os,re
from collections import Counter,deque
from operator import itemgetter
from itertools import accumulate
sys.setrecursionlimit(10**6)

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

for i in range(4):
    for j in range(3):
        print(" ",end='')
        print(*a[i][j])
    if i!=3:
        print("

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

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

Solution (Python):
import sys
n=int(input())
a=[[[0 for i in range(10)] for i in range(3)] for i in range(4)]
for i in range(n):
    w=input().split()
    b=(int(w[0]))
    f=(int(w[1]))
    r=(int(w[2]))
    v=(int(w[3]))
    a[b-1][f-1][r-1]+=v
for i in range(4):
    for j in range(3):
        for k in range(10):
            sys.stdout.write(" {0}".format(a[i][j][k]))
        sys.stdout.write("\n")
    if (i!=3):
        for x in range(20):
            sys.stdout.write("
        sys.stdout.write("\n")

Solution (Python):
buildings = [[[0 for room in range(10)] for floor in range(3)] for building in range(4)]

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

for i in range(4):
    for floor in buildings[i]:
        print("".join(map("{:2}".format, floor)))
    if i != 3:
        print("

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

for i in range(4):
    for j in range(3):
        if j!=0:
            print()
        for z in range(10):
            print(" %d"%builds[i][j][z],end = '')
    if i<3:
        print('\n
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(0, n):
  b, f, r, v = map(int, input().split()) 
  count[b-1][f-1][r-1] = count[b-1][f-1][r-1] + v

for k in range(0,4):
  for j in range(0, 3):
    for i in range(0, 10):
      print("",count[k][j][i], end=''"")
      if i == 9:
        print("")
  if k < 3:
    for l in range(0, 20):
      print("
    print("")