var input = ""
process.stdin.resume();
process.stdin.setEncoding('utf-8');
process.stdin.on('data', function(chunk) {
  input += chunk;
});
 
process.stdin.on('end', function() {
  input = input.split("\n");

  var room = new Array(4);
  for (i = 0; i < 4; i++) {
    room[i] = new Array(3);
    for (j = 0; j < 3; j++) {
      room[i][j] = new Array(10);
      for (k = 0; k < 10; k++) {
        room[i][j][k] = 0;
      }
    }
  }

  i = 1
  while (input[i] != 0) {
    arr = input[i].split(" ");
    b = arr[0] - 1;
    f = arr[1] - 1;
    r = arr[2] - 1;
    v = parseInt(arr[3], 10);

    room[b][f][r] += v;
    if (room[b][f][r] < 0) {
      room[b][f][r] = 0;
    } else if (room[b][f][r] > 9) {
      room[b][f][r] = 9;
    }
    i++;
  }

  for (i = 0; i < 4; i++) {
    for (j = 0; j < 3; j++) {
      console.log(" " + room[i][j].join(" "));
    }
    if (i != 3) {
      console.log("####################");
    }
  }
});