object Main extends App {
  val in = scala.io.Source.stdin.getLines.toSeq
  val B = in.tail.head.split(' ').map(_.toInt).toIndexedSeq
  
  private def func(b:IndexedSeq[Int]):Seq[Int] = {
    if(b.isEmpty) return Seq()
    //println(b)
    b.indices.foreach{ i =>
      if((i+1) == b(i)){ 
        val sub = func(b.take(i) ++ b.drop(i+1) )
        //println(sub)
        if(sub != null) return sub :+ (i+1)
      }
    }
    return null
  }
  val ret = func(B)
  if(ret == null) println(-1) else println(ret.mkString("\n"))
}
