p = Array.new(120, 0)
n = gets.to_i
for i in 1..n do
  a = gets.split(" ").map{|x| x.to_i}
  b = a[0] - 1
  f = a[1] - 1
  r = a[2] - 1
  v = a[3]
  idx = b * 30 + f * 10 + r
  p[idx] += v
end
for b in 0..3 do
  for f in 0..2 do
    for r in 0..9 do
      idx = b * 30 + f * 10 + r
      printf " %d", p[idx]
    end
    puts
  end
  puts "#" * 20 if b < 3
end
