def hill_climbing(A):
    """
    A represents a configuration of the problem.
    It has to be passed as argument of the function sons(A)
    ans value(A) that determines, respectively, the next
    configuration starting from A where Hill Climbing Algorithm
    needs to restart to evaluate and the heuristic function h.

    This function represents a template method.
    """
    best_val = sys.sizemax
    best_conf = None
    for conf in sons(A):
        val = value(conf)
        if best_val > val:
            best_conf = conf
            best_val = val

    if best_conf > value(A):
        return A

    return hill_climbing(best_conf)

    A represents a configuration of the problem.
    It has to be passed as argument of the function sons(A)
    ans value(A) that determines, respectively, the next
    configuration starting from A where Hill Climbing Algorithm
    needs to restart to evaluate and the heuristic function h.

    This function represents a template method.
    
recipes/Python/578157_Hill_Climbing_Template_Method/recipe-578157.py