def ord_mrv(csp):
    """
    Return the variable with the minimum remaining value (MRV).
    """
    # ANCHOR: alt version 1
    # variables = csp.get_all_unasgn_vars()
    # dom_sizes = [var.cur_domain_size() for var in variables]
    # min_index = dom_sizes.index(min(dom_sizes))
    # return variables[min_index]

    # ANCHOR: even shorter version!
    # variables = csp.get_all_unasgn_vars()
    # func = lambda var: var.cur_domain_size()
    # return min(variables, key=func)

    # ANCHOR: original version.. readable
    variables = csp.get_all_unasgn_vars()
    min_var = variables[0]
    min_dom_size = float('inf')
    for var in variables:
        dom_size = var.cur_domain_size()      # get the variables domain size

        if dom_size < min_dom_size:
            min_var = var
            min_dom_size = dom_size

    return min_var