def dfs(b, ans)
#  puts "b:" + b.inspect + " ans:" + ans.inspect
  if b.empty?
    ans.reverse_each { |v| puts v }
    return true
  end
  done = false
  for i in 0...(b.length) do
    if b[i] == i + 1
      b.delete_at(i)
      ans.push(i + 1)
      done = dfs(b, ans)
      ans.pop
      b.insert(i, i + 1)
    end
    break if done
  end
  return done
end

n = gets.to_i
b = gets.split.map(&:to_i)
t = b.tally
done = false
t.each do |i, v|
  if v > (n - i + 1)
    puts "-1"
    done = true
  end
  break if done
end
unless done
  done = dfs(b, [])
  puts "-1" unless done
end
