Before us is Mishnah 8 in the fifteenth chapter of Maseches Yevamos, which deals with a woman who testifies to the death of her husband and her son, and with the question of how the order of deaths she reports affects her status: whether she requires yibum or chalitzah.
The case is a woman who went out with her husband and her son to a country overseas - the three of them left together - and she returns alone and gives testimony about what happened there. At the time she left, she had a clear chazakah: she has a son, and therefore she is not in line to require yibum, since if her husband dies the son exempts her.
The first case: "mes ba'ali v'achar kach mes b'ni":
The woman says that her husband died first, and afterwards her son died. In this case she is believed and she is permitted to marry anyone, and she requires neither yibum nor chalitzah. The reason: at the time her husband died the son was alive, so no obligation of yibum ever took effect. Her account fits the situation that existed when she left, and therefore she remains in her original chazakah - and for that reason she is believed.
The second case: "mes b'ni v'achar kach mes ba'ali":
Here she reverses the order: the son died first, and afterwards the husband - and according to her account she requires yibum. In this ruling we take both directions into account:
"einah ne'emenes l'hisyabem" - she is not permitted to undergo yibum with the brother-in-law. On the strength of the original chazakah, the assumption is that she does not require yibum at all, since she had a son, and her claim that the son died first is not accepted.
"chosheshin l'devarehah v'choletzes" - for according to her own account she requires yibum or chalitzah in order to marry someone else. Therefore we take her words into consideration and require her to undergo chalitzah.
In summary: when the woman's testimony fits the chazakah with which she left - "mes ba'ali v'achar kach mes b'ni" - she is believed and permitted to marry anyone without yibum and without chalitzah. And when her testimony contradicts the chazakah - "mes b'ni v'achar kach mes ba'ali" - we are strict in both directions: she is not permitted to undergo yibum, on the strength of the chazakah that she does not require yibum, but we take her words into consideration and require her to undergo chalitzah so that she will be able to marry someone else.