object Main extends App {
    val hm = scala.collection.mutable.HashMap[(Int, Int, Int), Int]().withDefaultValue(0)
    val in = io.Source.stdin.getLines.map(_.split(" ").map(_.toInt))
    in.next
    for (Array(b, f, r, v) <- in) hm(b, f, r) += v
    for (b <- (1 to 4)) {
        for (f <- (1 to 3))
            println(" " + (1 to 10).map(hm(b, f, _)).mkString(" "))
        if (b != 4) println("####################")
    }
}