a = Array.new(4).map { Array.new(3).map { Array.new(10, 0) } }
n = gets.to_i
n.times do
  info = gets.split.map(&:to_i)
  b, f, r, v = info.map {|x| x - 1 }
  v += 1
  a[b][f][r] += v
end
(0..3).each do |b|
  (0..2).each do |f|
    puts " " + a[b][f] * " "
  end
  puts ?# * 20 if b < 3
end

