import java.io._
import java.util.StringTokenizer
import scala.util.control.Breaks.{breakable,break}

object Main extends App {
  val in = new InputReader(System.in)
  val pw = new PrintWriter(System.out)


  val N = in.next().toInt
  var b = new Array[Int](N+1)
  for(i <- 1 to N)
    b(i) = in.next().toInt


  //
  var ans = List[Int]()

  for(i <- 1 to N) {
    breakable{
      for(k <- (1 to (N-i+1)).reverse) {
        if(b(k) == k) {
          //println(k, b(k))
          ans = b(k) :: ans
          b = b.take(k) ++ b.drop(k+1)
          break
        }
      }
    }
  }


  if(ans.length != N)
    println(-1)
  else {
    for (e <- ans)
      pw.println(e)
    pw.flush()
  }
}


class InputReader(stream: InputStream) {
  private val reader = new BufferedReader(new InputStreamReader(stream))
  private var tokenizer: StringTokenizer = new StringTokenizer(reader.readLine())
  def next(): String = {
    while (!tokenizer.hasMoreTokens()) {
      tokenizer = new StringTokenizer(reader.readLine())
    }
    tokenizer.nextToken()
  }
}

