object Main {
  val Rooms: Int = 10
  val Floors: Int = 3
  val Buildings: Int = 4
  val Separator: String = "#" * 20

  def main(args: Array[String]): Unit = {
    val info = Array.ofDim[Int](Buildings, Floors, Rooms)

    val scanner = new java.util.Scanner(System.in)
    val n = scanner.nextInt()
    Iterator.from(0, 1)
      .takeWhile(_ < n)
      .map { _ => (
        scanner.nextInt() - 1,
        scanner.nextInt() - 1,
        scanner.nextInt() - 1,
        scanner.nextInt()
      )}
      .foreach { case (b, f, r, v) => info(b)(f)(r) += v }

    info
      .zipWithIndex
      .flatMap { case (floors, i) =>
        val rooms = floors.map(" " + _.mkString(" "))(collection.breakOut)
        if (i == 0)
          rooms
        else
          Separator +: rooms
      }
      .foreach(println)
  }
}