fun main(args : Array<String>) {
    val n = readLine()!!.toInt()
    val aa = readLine()!!.split(" ").map { it.toInt() }.toMutableList()

    val ans = mutableListOf<Int>()

    while (aa.size > 0) {
        var rightMostIdx = -1

        for (i in 1..aa.size) {
            if (aa[i-1] == i) rightMostIdx = i-1
        }

        if (rightMostIdx == -1) {
            println(-1)
            return
        }

        ans.add(aa[rightMostIdx])
        aa.removeAt(rightMostIdx)
    }

    println(ans.reversed().joinToString(separator = "\n"))
}