Yevamos11: 4
הָאִשָּׁה שֶׁנִּתְעָרֵב וַלְדָהּ בִּוְלַד כַּלָּתָהּ, הִגְדִּילוּ הַתַּעֲרוֹבוֹת, וְנָשְׂאוּ נָשִׁים, וָמֵתוּ — בְּנֵי הַכַּלָּה חוֹלְצִין וְלֹא מְיַבְּמִין, שֶׁהוּא סְפֵק אֵשֶׁת אָחִיו סְפֵק אֵשֶׁת אֲחִי אָבִיו; וּבְנֵי הַזְּקֵנָה אוֹ חוֹלְצִין אוֹ מְיַבְּמִין, שֶׁהוּא סְפֵק אֵשֶׁת אָחִיו וְאֵשֶׁת בֶּן אָחִיו.  מֵתוּ הַכְּשֵׁרִים — בְּנֵי הַתַּעֲרוֹבוֹת לִבְנֵי הַזְּקֵנָה חוֹלְצִין וְלֹא מְיַבְּמִין, שֶׁהוּא סְפֵק אֵשֶׁת אָחִיו וְאֵשֶׁת אֲחִי אָבִיו; וּבְנֵי הַכַּלָּה אֶחָד חוֹלֵץ וְאֶחָד מְיַבֵּם.
[If] a woman's baby became confused with her daughter-in-law's baby, and they grew to adulthood, and married and died —- the sons of the daughter-in-law perform chalitzah, but may not perform yibum, because it is uncertain [which is] their brother's wife and [which is] their father's brother's wife; the sons of the grandmother [however] may perform either chalitzah or yibum, since [their] uncertainty is [which is] their brother's wife and [which is] their brother's son's wife.  [If] the certain ones died —- the uncertain sons perform chalitzah, but not yibum, with the grandmother's sons' [widows], because it is uncertain [which is] their brother's wife and [which is] their father's brother's wife; and [with] the daughter-in-law's sons' [widows], one [of the uncertain ones] performs chalitzah and the other may [then] perform yibum.