# 解説PDFは読んだ
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
  (b.length - 1).downto(0) do |i|
    if b[i] == i + 1
      b.delete_at(i)
      ans.push(i + 1)
      done = dfs(b, ans)
#      ans.pop
#      b.insert(i, i + 1)
      break
    end
  end
  return done
end

n = gets.to_i
b = gets.split.map(&:to_i)
done = dfs(b, [])
puts "-1" unless done
