def dfs(a, xs)
  return [true, xs] if a.size == 0

  is = []
  a.size.times{|i| is.push(i) if a[i] == i }

  is.each do |i|
    aa = a.dup
    aa.delete_at(i)

    ys = xs.dup
    ys.push(i)

    ret = dfs(aa, ys)
    return ret if ret[0]
  end
  
  return [false, nil]
end

def main(argv)
  n = gets.chomp.to_i
  b = gets.chomp.split(' ').map(&:to_i)
  
  b.map!{|x| x - 1}
  ret = dfs(b, [])
  if ret[0] then
    ret[1].reverse.map{|x| x + 1}.each do |x|
      puts x.to_s
    end
  else
    puts (-1).to_s
  end
end

if self.to_s == 'main' then
  main(ARGV)
end