class Room {
    var numOfPeople: Int = 0

    override fun toString(): String {
        return " %d".format(numOfPeople)
    }
}

class Floor {
    val rooms = (1..10).map { _ -> Room() }.toList()
    override fun toString(): String {
        return rooms.joinToString("")
    }
}

class Building {
    val floors = (1..3).map { _ -> Floor() }.toList()
    override fun toString(): String {
        return floors.joinToString("\n")
    }
}

fun main(args: Array<String>) {
    val ownedBuildings = (1..4).map { _ -> Building() }.toList()

    val n = readLine()?.toInt() ?: return

    for (i in 1..n) {
        val inStr = readLine() ?: return

        val (b, f, r, v) = inStr.split(' ').map(String::toInt).toList()

        ownedBuildings[b - 1].floors[f - 1].rooms[r - 1].numOfPeople += v
    }
    val sepLine = "\n%s\n".format((1..20).map { _ -> "#" }.joinToString(""))
    println(ownedBuildings.joinToString(sepLine))
}

