import scala.io.StdIn.{readInt, readLine}

object Main extends App {
  val mansions = Array.fill(4, 3, 10)(0)

  val n = readInt()

  for (_ <- 1 to n) {
    val Array(b, f, r, v) = readLine.split(" ").map(_.toInt)
    if (v > 0) mansions(b - 1)(f - 1)(r - 1) += v else mansions(b - 1)(f - 1)(r - 1) += v
  }

  for (e <- mansions) {
    for (v <- e) {
      println(" " + v.mkString(" "))
    }
    if (!(e sameElements mansions.last)) println("#" * 20)
  }

}
