Yevamos 3:3-4
Yevamos 3:3
(Continuing the case of two sisters who come to two brothers for yibum.) If one of the women was prohibited to one of the brothers as a Torah prohibition and the other woman was prohibited to the other brother as a Torah prohibition, each brother may marry the other woman, who is permitted to him. This is what the Sages meant when they said (in mishna 2:3) that if a woman’s sister is her sister-in-law (i.e., married to her husband’s brother), she may perform chalitzah or yibum.
Yevamos 3:4
If there are three brothers and two of them married sisters, or a woman and her daughter, or a woman and her granddaughter - whether through her son or her daughter - then they perform chalitzah and not yibum, though Rabbi Shimon exempts them altogether. If one was prohibited as a forbidden relationship, then he is permitted to marry the other. If one of the women is prohibited by a “mitzvah” prohibition or a “sanctity” prohibition (see mishna 2:4), they perform chalitzah rather than yibum.