def eliminate_from_neighbors(csp, var) :
    """
    Eliminates incompatible values from var's neighbors' domains, modifying
    the original csp.  Returns an alphabetically sorted list of the neighboring
    variables whose domains were reduced, with each variable appearing at most
    once.  If no domains were reduced, returns empty list.
    If a domain is reduced to size 0, quits immediately and returns None.
    """
    def check_constraint(var1, var2, val1, val2):
        """
        Checks whether there is a constraint violation between var1/val1 and var2/val2.
        Returns True if there isn't a violation or false if there is.
        """
        constraints = csp.constraints
        for constraint in constraints:
            if (constraint.var1 == var1 or constraint.var1 == var2) and (constraint.var2 == var1 or constraint.var2 == var2):
                if not constraint.check(val1, val2):
                    return False
        return True
    
    reduced_neighbors = []
    neighbors = csp.get_neighbors(var)
    unassig_var = csp.unassigned_vars
    values = csp.get_domain(var)
    remove_n_values = {}
    
    
    #Building dictionary of neighbors and values that conflict
    for n in neighbors:
        if n in unassig_var:
            n_values = csp.get_domain(n)
            remove_n_values[n] = []
            for n_val in n_values:
                constraint_check = []
                for val in values:
                    if check_constraint(var,n,val,n_val):
                        constraint_check.append(0)
                    else:
                        constraint_check.append(1)
                if sum(constraint_check) == len(constraint_check):
                    remove_n_values[n].append(n_val)
    
    #Remove values from neighbors if they conflict. Check if domain is reduced to 0.
    for n in remove_n_values:
        for n_val in remove_n_values[n]:
            csp.eliminate(n,n_val)
        if len(csp.get_domain(n)) == 0:
            return None
        if len(remove_n_values[n]) > 0:
            reduced_neighbors.append(n)
    
    return reduced_neighbors