Snuke has an empty sequence a.  He will perform N operations on this sequence.  In the i-th operation, he chooses an integer j satisfying 1 \leq j \leq i, and insert j at position j in a (the beginning is position 1).  You are given a sequence b of length N. Determine if it is possible that a is equal to b after N operations. If it is, show one possible sequence of operations that achieves it.
n = int(input())
b = list(int(x) for x in input().split())
revans = []
flg = True
cond = True
while(flg):
    for i, item in enumerate(b):
        if i == len(b)-1:
            if item == len(b):
                revans.append(b.pop(i))
            else:
                flg = False
                cond = False
                break
        else:
            if item == i+1:
                if b[i+1] == item + 1:
                    continue
                else:
                    revans.append(b.pop(i))
                    break
    print(b)
    if b == []:
        flg = False

if cond:
    revans.reverse()
    for item in revans:
        print(item)
else:
    print(-1)

n = int(input())
b = list(int(x) for x in input().split())
revans = []
flg = True
cond = True

while(flg):
    removable = []
    for i, item in enumerate(b):
        if item == i+1:
            removable.append(i)

    if removable == []:
        flg = False
        cond = False
        break

    revans.append(b.pop(max(removable)))

    if b == []:
        flg = False

if cond:
    for item in reversed(revans):
        print(item)
else:
    print(-1)
