
ans = []
4.times do
    ans << [("0"*10).split(""),("0"*10).split(""),("0"*10).split("")]
end

n = gets.to_i
n.times do
  a,b,c,d = gets.split.map(&:to_i)
  ans[a-1][b-1][c-1]  = (d + (ans[a-1][b-1][c-1]).to_i).to_s
end

ctn = 0
ans.each do |arr|
  puts " " + arr[0].join(" ")
  puts " " +arr[1].join(" ")
  puts " " +arr[2].join(" ")

  puts "####################" if ctn <= 2
  ctn += 1
end
