import std.algorithm, std.array, std.container, std.range, std.bitmanip;
import std.numeric, std.math, std.bigint, std.random, core.bitop;
import std.string, std.regex, std.conv, std.stdio, std.typecons;

void main()
{
  auto n = readln.chomp.to!size_t;

  auto dat = new int[][][](4, 3, 10);
  foreach (_; 0..n) {
    auto rd = readln.split.map!(to!int);
    auto b = rd[0] - 1, f = rd[1] - 1, r = rd[2] - 1, v = rd[3];
    dat[b][f][r] += v;
  }

  foreach (i, b; dat) {
    foreach (f; b) {
      writeln(f.map!(to!string).join(" "));
    }
    if (i < dat.length - 1)
      writeln("####################");
  }
}