def METHOD_NAME(sol):
    es, ls = zip(*sol)
    es = [
        set(i for i in t if i is not None)
        for t in itertools.zip_longest(*es)
    ]
    ls = [
        set(i for i in t if i is not None)
        for t in itertools.zip_longest(*ls)
    ]
    return es, ls