h = Array.new(5){ Array.new(4){ Array.new(11,0) } }
n = gets.to_i
n.times do
  a,b,c,d = gets.split.map(&:to_i)
  h[a][b][c] += d
end

for i in 1..4
  for j in 1..3
    puts h[i][j].join(" ")      
  end
  puts "#"*20 if i<4
end