object Main{
  def main(args:Array[String]){
    val sc = new java.util.Scanner(System.in)
    val SEP="####################"
    val n=sc.nextInt
    var a=Array.fill(4,3,10)(0)
    for(i<-0 until n){
      val b,f,r,v=sc.nextInt
      a(b-1)(f-1)(r-1)+=v
    }
    println(a.map(_.map(_.map(" "+_).mkString).mkString("\n")).mkString("\n"+SEP+"\n"))
  }
}