כתובות י:א · Ketubot 10:1

מִי שֶׁהָיָה נָשׂוּי שְׁתֵּי נָשִׁים וּמֵת, הָרִאשׁוֹנָה קוֹדֶמֶת לַשְּׁנִיָּה, וְיוֹרְשֵׁי הָרִאשׁוֹנָה קוֹדְמִין לְיוֹרְשֵׁי שְׁנִיָּה. נָשָׂא אֶת הָרִאשׁוֹנָה וָמֵתָה, נָשָׂא שְׁנִיָּה וּמֵת הוּא, שְׁנִיָּה וְיוֹרְשֶׁיהָ קוֹדְמִים לְיוֹרְשֵׁי הָרִאשׁוֹנָה:
In the case of one who was married to two women and died, the first woman he married precedes the second in collecting the payment specified in her marriage contract if there are insufficient funds to pay both, because her document is dated earlier. So too, if the wives died after their husband before they received payment for their marriage contracts, the heirs of the first wife precede the heirs of the second wife in collecting these payments. If he married a first woman and she subsequently died, and he then married a second woman and he subsequently died, the second wife and her heirs precede the heirs of the first wife. This is because the marriage contract of the second wife is considered a debt that the estate of the deceased is required to pay, whereas the claim of the heirs of the first wife is based on the stipulation in the marriage contract that male children inherit their mother’s marriage contract. Heirs receive their share of the estate only from property that remains after all debts have been settled.

Word-by-word Breakdown (מילים ושרשים)

מִי → One שֶׁהָיָה → who was [ה - י - ה]נָשׂוּי → married to [נ - ש - א]שְׁתֵּי → two [ש - ת - ה]נָשִׁים → women [נ - ש - ה]וּמֵת → and died [מ - ו - ת]הָרִאשׁוֹנָה → the first [ר - א - ש]קוֹדֶמֶת → precedes [ק - ד - מ]לַשְּׁנִיָּה → the second [ש - נ - ה]וְיוֹרְשֵׁי → and the heirs of [י - ר - ש]הָרִאשׁוֹנָה → the first [ר - א - ש]קוֹדְמִין → precede [ק - ד - מ]לְיוֹרְשֵׁי → the heirs of [י - ר - ש]שְׁנִיָּה → the second [ש - נ - ה]נָשָׂא → If he married [נ - ש - א]אֶת → [direct object marker] הָרִאשׁוֹנָה → the first [ר - א - ש]וָמֵתָה → and she died [מ - ו - ת]נָשָׂא → and he married [נ - ש - א]שְׁנִיָּה → a second [ש - נ - ה]וּמֵת → and died [מ - ו - ת]הוּא → he שְׁנִיָּה → the second [ש - נ - ה]וְיוֹרְשֶׁיהָ → and her heirs [י - ר - ש]קוֹדְמִים → precede [ק - ד - מ]לְיוֹרְשֵׁי → the heirs of [י - ר - ש]הָרִאשׁוֹנָה → the first [ר - א - ש]