MODE = "stdio"

line = Array.new

if(defined? MODE)
  line = STDIN.read.split("\n")
else
  tmp = "\
  3
  1 1 3 8
  3 2 2 7
  4 3 8 1
  ".split("\n")
  tmp.each{|s|
    line << s.strip
  }
end
n =  line[0].to_i

ary = Array.new(4){Array.new(3){Array.new(10,0)}}

(1..n).each do |num|
b,f,r,v = line[num].split(" ").map(&:to_i)
ary[b-1][f-1][r-1] += v
end
idx=0
ary.each do |s|
  s.each do |ss|
    puts ss.join(" ")
  end
  idx += 1
  puts '#'*20 if idx<=3
end