Yevamos 11:3-4
Yevamos 11:3
Let’s say that five women and their sons get mixed up so that they don’t know whose son is whose. (Each of these women has other sons who did not get mixed up.) These boys grow up, get married, and die. Four surviving un-mixed brothers perform chalitzah with the first widow and one may perform yibum. That brother and three others perform chalitzah with the next widow and one may perform yibum. This is the process with each widow so that every woman performs chalitzah with four of them and yibum with one of them.
Yevamos 11:4
Let’s say that a woman’s son got mixed up with her daughter-in-law’s son so that they don’t know whose son is whose. These boys grew up, married and died. In such a case, the daughter-in-law’s other sons perform chalitzah with both women but not yibum because there is a doubt whether each widow is his brother’s wife or his father’s brother’s wife (which is a prohibited relationship). The sons of the grandmother may perform either chalitzah or yibum because there the doubt is whether each widow is his brother’s wife or his brother’s son’s wife (which is a permitted relationship). If the un-mixed sons were the ones who died, the sons who had been mixed up perform chalitzah with the widow of the grandmother’s son but not yibum because she is either his brother’s wife or his father’s brother’s wife. With the widow of the daughter-in-law’s son, one performs chalitzah and the other performs yibum because she is either his brother’s wife or his brother’s son’s wife.