#!/usr/bin/ruby
# -*- coding: utf-8 -*-
=begin
ITP1_6-C

Array - Official House
????????¶??? : 1 sec, ?????¢?????¶??? : 65536 KB
??¬????????\?±??????°

?????§?????????????????¢????????¨?±?????????????????????¬???????£??????????????????????????????¬????????\?±??????????????????±???????????????????????¨?±??????\?±??????°???????????????????????°?????????????????????????????????

n??¶????????±????????????????????????????????±??§?????????????????´??°b, f, r, v????????????????????????????????????b?£?f??????r???????????¨?±????v??????????????§??\?±????????????¨??????????????????v?????????????????´??????v????????????????????¨??????????????????

???????????¨????????¨?±?????????°?????\?±????????????????????????¨????????????
Input

????????????????????±?????° n ????????????????????????

?¶??????? n ??¶????????±????????????????????????????????±?????????????????´??° b, f, r, v ????????????????????§??????????????????????????????
Output

????£???????????????\?±??????°???????????????????????????????£???????????????????????????????????????????????????\?±??????°??????????????????????????????????????????????????????????????????????????????????????????????????¨?±??????\?±??????°????????????????????????????????\?±??????°???????????????????????????????????????????????????????????????????£?????????????####################(20??????#)??§????????£???????????????
Constraints

    ????????£????£??????????????????¨?±???????????????????????????????
    ?????????????¨???§?????¨?±??????\?±??????°?????????????°??????????????????¨????????????
    ?????????????¨???§?????¨?±??????\?±??????°???9???????????????????????¨????????????

Sample Input

3
1 1 3 8
3 2 2 7
4 3 8 1

Sample Output

 0 0 8 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 7 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 1 0 0

=end

n = STDIN.gets.to_i
dt = Hash.new
while $_=STDIN.gets
  fl = $_.split.map!{|x| x.to_i}
  b=fl[0]
  f=fl[1]
  r=fl[2]
  v=fl[3]
  ky = format("%d:%d:%d", b, f, r)
  if dt.has_key?(ky) then
    dt[ky] += v
  else
    dt[ky] = v
  end
end

(1..4).each {|b|
  puts "####################"  if b!=1
  (1..3).each {|f|
    (1..10).each {|r|
      ky = format("%d:%d:%d", b, f, r)
      if dt.has_key?(ky) then
        num=dt[ky]
      else
        num=0
      end
      printf(" %d", num)
    }
    puts
  }
}