n = gets.to_i
rooms = Array.new(4) {Array.new(3) {Array.new(10, 0)}}
n.times do
  b, f, r, v = gets.split.map(&:to_i)
  rooms[b - 1][f - 1][r - 1] += v
end
st = Array.new(4, "")
4.times do |b|
  3.times do |f|
    10.times do |r|
      st[b] += " " + rooms[b][f][r].to_s
    end
    st[b] += "\n"
  end
end
print st.join("#" * 20 + "\n")
