num = gets.to_i
array = []
line = "####################"
resident = Array.new(4){|i| Array.new(3){|i| Array.new(10, 0)}}

def calc_num(info, resident)
  # puts info
  resident[info[:building] - 1][info[:floor] - 1][info[:room] - 1] += info[:v]
  return resident
end

def describe(building)
  output = ""
  for i in 0..building.length - 1 do
    for j in 0..building[i].length - 1 do
      output += " "
      output += building[i][j].to_s
    end
    output += "\n"
  end
  puts output
end

for i in 1..num do
  input = gets.chomp
  info = input.split(" ")
  info2 = {building:(info[0].to_i), floor:(info[1].to_i), room:(info[2].to_i), v:(info[3].to_i)}
  array << info2
end

# puts line

for j in 0..array.length - 1 do
  info = array[j]
  resident = calc_num(info, resident)
end

# puts line

for i in 0..resident.length - 1 do
  describe(resident[i])
  if i != resident.length - 1 then
    puts line
  end
end