n = int(eval(input()))

b = list(map(int, input().split()))

for i in range(n):

  if b[i] > i+1:

    print((-1))

    break

else:

  ans = []

  while len(b) > 1:

#    print(ans,b)

    c = len(ans)

    f = b[0]

    for i in range(1, len(b))[::-1]:

      if b[i] == i + 1:

#        print("check", b[i:])

        ans.append(b.pop(i))

        break

    else:

      for i in range(1, len(b)):

#      print(f, i, b, n - c, ans)

        if f >= b[i]:

          ans.append(b.pop(i-1))

          break

        elif n - c == b[i]:

          ans.append(b.pop(i))

          break

        elif i == len(b) - 1:

          ans.append(b.pop(-1))

          break

        else:

          f = b[i]

  ans.append(1)

  for i in range(n)[::-1]:

    print((ans[i]))
n = int(eval(input()))

b = list(map(int, input().split()))

for i in range(n):

  if b[i] > i+1:

    print((-1))

    break

else:

  ans = []

  while len(b) > 0:

    f = b[0]

    for i in range(len(b))[::-1]:

      if b[i] == i + 1:

        ans.append(b.pop(i))

        break



  for i in range(n)[::-1]:

    print((ans[i]))
n = int(eval(input()))
b = list(map(int, input().split()))
for i in range(n):
    if b[i] > i + 1:
        print((-1))
        break
else:
    ans = []
    while len(b) > 1:
        #    print(ans,b)
        c = len(ans)
        f = b[0]
        for i in range(1, len(b))[::-1]:
            if b[i] == i + 1:
                #        print("check", b[i:])
                ans.append(b.pop(i))
                break
        else:
            for i in range(1, len(b)):
                #      print(f, i, b, n - c, ans)
                if f >= b[i]:
                    ans.append(b.pop(i - 1))
                    break
                elif n - c == b[i]:
                    ans.append(b.pop(i))
                    break
                elif i == len(b) - 1:
                    ans.append(b.pop(-1))
                    break
                else:
                    f = b[i]
    ans.append(1)
    for i in range(n)[::-1]:
        print((ans[i]))

n = int(eval(input()))
b = list(map(int, input().split()))
for i in range(n):
    if b[i] > i + 1:
        print((-1))
        break
else:
    ans = []
    while len(b) > 0:
        f = b[0]
        for i in range(len(b))[::-1]:
            if b[i] == i + 1:
                ans.append(b.pop(i))
                break
    for i in range(n)[::-1]:
        print((ans[i]))

-    while len(b) > 1: -        #    print(ans,b) -        c = len(ans) +    while len(b) > 0: -        for i in range(1, len(b))[::-1]: +        for i in range(len(b))[::-1]: -                #        print("check", b[i:]) -        else: -            for i in range(1, len(b)): -                #      print(f, i, b, n - c, ans) -                if f >= b[i]: -                    ans.append(b.pop(i - 1)) -                    break -                elif n - c == b[i]: -                    ans.append(b.pop(i)) -                    break -                elif i == len(b) - 1: -                    ans.append(b.pop(-1)) -                    break -                else: -                    f = b[i] -    ans.append(1)