def _restricted_growth_notation(l):
        list_length = len(l)
        d = defaultdict(list)
        for (i, element) in enumerate(l):
            d[element].append(i)
        l2 = [None] * list_length
        for (name, index_list) in enumerate(sorted(d.values(), key=min)):
            for index in index_list:
                l2[index] = name
        return tuple(l2)