gets
h=(1..12).to_a.map{[0]*10}
while l=gets
  b,f,r,v=l.split(' ').map(&:to_i)
  h[(b-1)*3+(f-1)][r-1]+=v
end
puts (h.each_slice(3).map do |hs|
  hs.map{|h| (['']+h).join(' ')}.join("\n")
end.join("\n"+'#'*20+"\n"))