n = gets.to_i
vec = Array.new(4) { Array.new(3) { Array.new(10, 0) } }

n.times do
  b, f, r, v = gets.split.map(&:to_i)
  vec[b - 1][f - 1][r - 1] += v
end

vec.each_with_index do |v, i|
  v.each do |w|
    puts ' ' + w.join(' ')
  end
  puts '#' * 20 if i != vec.size - 1
end

