process.stdin.resume();
process.stdin.setEncoding("utf8");

const reader = require("readline").createInterface({
  input: process.stdin,
  output: process.stdout,
});

const lines = [];

reader.on("line", (line) => {
  lines.push(line);
});

reader.on("close", () => {
  const n = Number(lines[0]);
  const c = () => ({
    "1": Array(10).fill(0),
    "2": Array(10).fill(0),
    "3": Array(10).fill(0),
  });
  const room = {
    "1": c(),
    "2": c(),
    "3": c(),
    "4": c(),
  };
  for (let i = 1; i <= n; i++) {
    const [b, f, r, v] = lines[i].split(" ").map(Number);
    room[b][f][r - 1] = room[b][f][r - 1] + v;
  }
  const outs = [];
  for (let i = 1; i <= 4; i++) {
    let o = "";
    for (let j = 1; j <= 3; j++) {
      o += ` ${room[i][j].join(" ")}\n`;
    }
    outs.push(o);
  }
  process.stdout.write(outs.join("####################\n"));
});

