Yevamos1: 2
כֵּיצַד פּוֹטְרוֹת צָרוֹתֵיהֶן? הָיְתָה בִּתּוֹ אוֹ אַחַת מִכָּל הָעֲרָיוֹת הָאֵלּוּ נְשׂוּאָה לְאָחִיו, וְלוֹ אִשָּׁה אַחֶרֶת, וָמֵת — כְּשֵׁם שֶׁבִּתּוֹ פְּטוּרָה, כָּךְ צָרָתָהּ פְּטוּרָה. הָלְכָה צָרַת בִּתּוֹ וְנִשֵּׂאת לְאָחִיו הַשֵּׁנִי, וְלוֹ אִשָּׁה אַחֶרֶת, וָמֵת — כְּשֵׁם שֶׁצָּרַת בִּתּוֹ פְּטוּרָה, כָּךְ צָרַת צָרָתָהּ פְּטוּרָה, אֲפִלּוּ הֵן מֵאָה.  כֵּיצַד אִם מֵתוּ צָרוֹתֵיהֶן מֻתָּרוֹת? הָיְתָה בִתּוֹ אוֹ אַחַת מִכָּל הָעֲרָיוֹת הָאֵלּוּ נְשׂוּאָה לְאָחִיו, וְלוֹ אִשָּׁה אַחֶרֶת, מֵתָה בִתּוֹ אוֹ נִתְגָּרְשָׁה, וְאַחַר כָּךְ מֵת אָחִיו — צָרָתָהּ מֻתֶּרֶת.  וְכָל הַיְכוֹלָה לְמָאֵן, וְלֹא מֵאֲנָה — צָרָתָהּ חוֹלֶצֶת וְלֹא מִתְיַבֶּמֶת.
How do they release their co-wives? [If] a [man's] daughter, or [any] one of these forbidden relations, was married to his brother, and he had another wife [as well], and he died —- just as his daughter is released, so too is her co-wife. If his daughter's co-wife went and married his second brother, and he [also] had another wife, and [then] he died —- just as his daughter's co-wife is released, so too is her co-wife's co-wife, even if there are a hundred.  How is it that if they died their co-wives are permitted? [If] a [man's] daughter, or [any] one of these forbidden relatives, was married to his brother, and he [also] had another wife, and his daughter died, or was divorced, and then his brother died —- her co-wife is permitted.  Anyone who was able to refuse but did not do so —- her co-wife requires chalitzah but is prohibited from yibum.