Shevuos, Chapter 4, Mishnah 4. This mishnah deals with the connection between the two witnesses in an oath of testimony: how the denial of one affects the liability of the other.
Three forms of denial:
"Kafru sh'neihem k'achas" - both witnesses deny together that they know any testimony, and then "sh'neihem chayavin" - both are liable.
"B'zeh achar zeh" - the first one denied, and after him the second one denied, and then "harishon chayav v'hasheni patur" - the first is liable and the second is exempt. The first is liable to bring a korban oleh v'yored and has transgressed the oath of testimony, since at the moment he denied there was still the possibility of two witnesses. But once the first one denied, the second was left as a single witness whose testimony can accomplish nothing, and even had he wanted to testify his testimony would have been worthless, and therefore he is exempt.
"Kafar echad v'hodah echad" - the one who denied is liable, while the one who admitted that he knows testimony is exempt.
Two sets of witnesses:
The mishnah continues: "Hayu sh'tei kitei eidim, kafrah harishonah v'achar kach kafrah hasheniyah - sh'teihen chayavos, bizman she'ha'eidus yecholah l'hiskayem bish'teihen" - if there were two sets of witnesses, and the first set denied and afterward the second set denied, both are liable, when the testimony could be established through either of them. That is, four witnesses in all, forming two sets: the first set denied knowing the testimony and afterward the second set denied as well, and both are liable.
This ruling raises an obvious difficulty, and the Gemara addresses it: when a second set of witnesses exists, the denial of the first set causes no loss whatsoever to the claimant, since he has another pair of witnesses available who can testify for him. If so, how can there be a case in which both sets are liable? Seemingly the first set should have been able to rely on the second set.
The Gemara's explanation:
The mishnah is speaking of a unique situation: at the time the first set denied knowing the testimony, the second set was disqualified from testifying because of family relationship, since the wives of its witnesses were relatives of the claimant or of the defendant. However, those women were dying, lying on their deathbeds.
The mishnah teaches us that even though we have a principle that most people in this state do in fact die, so that presumably the family relationship will lapse very shortly, as long as the women have not yet died the second set is not fit to testify, since at this moment they are relatives. And since that is so, the first set is liable for the oath of testimony, because at that moment there was no fit second set upon which they could rely.
From here the mishnah continues: after the women died and the family relationship lapsed, the second set became fit to testify. If at that point they too denied knowing the testimony, then they are the ones who actually cause the loss, since at this moment they are valid witnesses, and therefore they too are liable.
In summary: in this scenario both sets are liable: the first set is liable because at the time of its denial the second set was related and disqualified from testifying, and the second set is liable because at the time of its denial its family relationship had already lapsed and it was fit to testify.