constructs a relation's dictionary from a list that describes amphidromus relations between objects

    :param list rel_lst: a relationships list of the form [[a,b],[c, a, b]]  # can include duplicates
    :returns: a dictionary

    :Example:
        >>> rl = [('a', 'b', 'c'), ('a', 'x', 'y'), ('x', 'y', 'z')]
        >>> relations_dict(rl)
        {'a': ['x', 'c', 'b', 'y'], 'c': ['a', 'b'], 'b': ['a', 'c'], 'y': ['a', 'x', 'z'], 'x': ['a', 'z', 'y'],
         'z': ['y', 'x']}

def relations_dict(rel_lst):
    """constructs a relation's dictionary from a list that describes amphidromus relations between objects

    :param list rel_lst: a relationships list of the form [[a,b],[c, a, b]]  # can include duplicates
    :returns: a dictionary

    :Example:
        >>> rl = [('a', 'b', 'c'), ('a', 'x', 'y'), ('x', 'y', 'z')]
        >>> relations_dict(rl)
        {'a': ['x', 'c', 'b', 'y'], 'c': ['a', 'b'], 'b': ['a', 'c'], 'y': ['a', 'x', 'z'], 'x': ['a', 'z', 'y'],
         'z': ['y', 'x']}
    """
    dc = {}
    for c in rel_lst:
        for i in c:
            for k in c:
                dc.setdefault(i, [])
                dc[i].append(k)
    do = {}
    for k in list(dc.keys()):
        if dc[k]:
            vl = list(set(dc[k]))   # remove duplicates
            vl.remove(k)
            do[k] = vl
    return do