import java.util.*

data class Room(val ridge: Int, val floor: Int, val number: Int)

fun main(args: Array<String>) {
    val scanner = Scanner(System.`in`)
    val n = scanner.nextInt()
    val roomMap = mutableMapOf<Room, Int>()
    (1..n).forEach {
        roomMap.merge(
            Room(scanner.nextInt(), scanner.nextInt(), scanner.nextInt()),
            scanner.nextInt(),
            Int::plus
        )
    }
    (1..4).forEach { ridge ->
        (1..3).forEach { floor ->
            (1..10).forEach { number ->
                print(" " + roomMap.getOrDefault(Room(ridge, floor, number), 0))
            }
            println()
        }
        if (ridge != 4) {
            println("####################")
        }
    }
}
