n = gets.chomp.to_i
b = gets.split.map(&:to_i)
h = Hash.new(0)
p = b.permutation(b.size)
def assemble(ary)
  a = []
  0.upto(ary.size-1) do |i|
    a.insert(ary[i]-1, ary[i])
  end
  a
end
p.each do |bb|
  flag = true
  0.upto(n-1) do |i|
    if bb[i] > i + 1
      flag = false
      break
    end
  end
  if flag
    ans = assemble(bb)
    if ans == b
      puts bb
      exit
    end
  end
end
puts (-1)
