let split str delim =
  let rec doit s acc =
    match
      try Some (String.index s delim)
      with _ -> None
    with
    | None -> s :: acc
    | Some i ->
        let s1 = String.sub s 0 i in
        let s2 = String.sub s (i + 1) (String.length s - String.length s1 - 1) in
        doit s2 (s1 :: acc)
  in
  List.rev (doit str [])

let () =
  let max_b = 4 in
  let max_f = 3 in
  let max_r = 10 in
  let ary = Array.make (max_b * max_f * max_r) 0 in
  let n = read_int () in
  for _ = 1 to n do
    let l = read_line () in
    match List.map int_of_string (split l ' ') with
    | [] | [_] | _::_::[] | _::_::_::[] -> exit 1
    | b :: f :: r :: v :: _ ->
        ary.(max_f*max_r*(b-1) + max_r*(f-1) + (r-1)) <- ary.(max_f*max_r*(b-1) + max_r*(f-1) + (r-1)) + v
  done;
  for b = 1 to max_b do
    for f = 1 to max_f do
      for r = 1 to max_r do
        Printf.printf " %d" ary.(max_f*max_r*(b-1) + max_r*(f-1) + (r-1))
      done;
      print_newline ()
    done;
    if b <> max_b then Printf.printf "####################\n"
  done