object Main extends App {
	override def main(args:Array[String]) = {
		val sc = new java.util.Scanner(System.in)
		
		val rooms = getAllRooms
		val map = new scala.collection.mutable.HashMap[Room , Int]();
		
		val n = sc.nextInt
		(1 to n).foreach{ x =>
			val a,f,r,v = sc.nextInt
			val room = Room(a,f,r)
			val newVal = map.getOrElse(room,0) + v
			map.put(room,newVal)
		}
		
		printRooms(map, new java.io.PrintWriter(System.out))
		
	}
	
	case class Room(apt :Int, floor :Int, room:Int)

	def getAllRooms = 
		for(a <- (1 to 4) ; f <- (1 to 3) ; r <- (1 to 10) ) yield Room(a,f,r)
		
	def printRooms(map:scala.collection.mutable.Map[Room,Int], pw : java.io.PrintWriter):Unit = {
		for(a <- (1 to 4)){
			for(f <- (1 to 3)){
				for(r <- (1 to 10)){
					val v = map.getOrElse(Room(a,f,r), 0 )
					print(v)
					if(r != 10){
						print(" ")
					}
				}
				if(f != 3){
					println()
				}
			}
			if(a != 4){
				println()
				println("####################")
			}
		}
	}
	
}