def find_ccs(unmerged):
    """
    Find connected components of a list of sets.
        E.g.
    x = [{'a','b'}, {'a','c'}, {'d'}]
    find_cc(x)
    
        [{'a','b','c'}, {'d'}]
    """
    merged = set()
    while unmerged:
        elem = unmerged.pop()
        shares_elements = False
        for s in merged.copy():
            if not elem.isdisjoint(s):
                merged.remove(s)
                merged.add(frozenset(s.union(elem)))
                shares_elements = True
        if not shares_elements:
            merged.add(frozenset(elem))

    return [list(x) for x in merged]