from typing import Dict
from typing import List
from typing import Set


def get_parents_of(image_and_parents: Dict[str, List[str]], commit_id: str) -> Set[str]:
    """Returns a set of all parents of a given commit id."""
    parents = None
    parents_list = [commit_id]
    i = 0
    while i < len(parents_list):
        cur_image = parents_list[i]
        parents = image_and_parents[cur_image]
        for parent in parents:
            parents_list.append(parent)
        i += 1
    return set(parents_list)