Given an infinite ancestral tree where every person has two parents (child -> parent links), determine whether two given people are siblings.
Asked in the onsite DSA 2 stage. This is not a normal tree: each node has two parents. Reported follow-ups include determining first cousins and finding the lowest common ancestor.
Implement are_siblings(person1, person2, parents). parents maps each person ID to a list of their two parent IDs. Return True when the two distinct people share at least one immediate parent, otherwise return False. A person absent from parents has no listed parents.
def are_siblings(person1, person2, parents):