number = gets.to_i
building_information =[
    [[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0]],
    [[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0]],
    [[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0]],
    [[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0]]
]
number.times do
    info = gets.split.map(&:to_i)
    building_information[info[0]-1][info[1]-1][info[2]-1] += info[3]
end

building_information.each_with_index do |building_number,index|
    building_number.each do |floor|
        puts " "+floor.join(" ")
    end
    if index!=3
        puts "####################"
    end
end
