n = gets.to_i
room = Array.new(4){Array.new(30, 0)}

while line = gets do
  b, f, r, v = line.split.map(&:to_i)
  room[b - 1][10 * (f - 1) + (r - 1)] += v
end

4.times do |i|
  3.times do |j|
    10.times do |k|
      j != 9 ? print "#{room[i][10 * i + k]} " : print room[i][10 * i + k]
    end
    puts
  end
  puts "####################"
end