object Main {

    def main(args: Array[String]): Unit = {
        val sc = new java.util.Scanner(System.in)

        val n = sc.nextInt
        val tenants = Array.ofDim[Int](4, 3, 10)

        for( i <- 0 until n ) {
            val b, f, r, v = sc.nextInt
            tenants(b-1)(f-1)(r-1) += v
        }

        for( i <- 0 until 4 ) {
            for( j <- 0 until 3 ) {
                println(" " +tenants(i)(j).mkString(" "))
            }
            if( i < 3 ) println("#"*20)
        }
    }
}

