let print_floor a =
  Array.iter (fun n -> Printf.printf " %d" n) a;
  print_newline ()
let print_building a =
  Array.iter (fun f -> print_floor f) a
let print_house a =
  print_building a.(0);
  print_endline (String.make 20 '#');
  print_building a.(1);
  print_endline (String.make 20 '#');
  print_building a.(2);
  print_endline (String.make 20 '#');
  print_building a.(3)

let () =
  let house = [|(Array.make_matrix 3 10 0);(Array.make_matrix 3 10 0);
                (Array.make_matrix 3 10 0);(Array.make_matrix 3 10 0)|] in
  let count = read_int () in
  let rec loop i =
    if i >= count then print_house house
    else
      let line = read_line () in
      let b,f,r,v = Scanf.sscanf line "%d %d %d %d"
          (fun b f r v -> b-1,f-1,r-1,v) in
      house.(b).(f).(r) <- house.(b).(f).(r) + v;
      loop (i+1) in
  loop 0