a=Array.new(12).map{Array.new(10,0)}
gets.to_i.times do
  x=gets.split.map &:to_i
  a[(x[0]-1)*3+x[1]-1][x[2]-1]+=x[3]
end
a.size.times do|i|
  a[i].each{|j|print" #{j}"}
  if (i+1)%3==0&&i+1<a.size then print"\n","#"*20 end
  print "\n"
end

