arr=Array.new(4){Array.new(3){Array.new(10,0)}}
gets.to_i.times do
    b=gets.split.map(&:to_i)
    arr[b[0]-1][b[1]-1][b[2]-1]+=b[3]
end
4.times do |i|
    arr[i].each { |b| puts " "+b.join(" ") }
    puts "#"*20 if i < 3
end