def update(house, f, r, v)
  house[10 * (f - 1) + (r - 1)] += v
end

def print_house(house)
  house.each_slice(10) do |v|
    puts " %d %d %d %d %d %d %d %d %d %d" % v
  end
end

house1 = Array.new(30, 0)
house2 = Array.new(30, 0)
house3 = Array.new(30, 0)
house4 = Array.new(30, 0)

n = gets.chomp.to_i
n.times do
  b, f, r, v = gets.chomp.split.map(&:to_i)
  case b
  when 1 then update(house1, f, r, v)
  when 2 then update(house2, f, r, v)
  when 3 then update(house3, f, r, v)
  when 4 then update(house4, f, r, v)
  end
end

print_house house1
puts '#' * 20
print_house house2
puts '#' * 20
print_house house3
puts '#' * 20
print_house house4