Nazir, Chapter 4, Mishnah 1:
The Mishnah opens: "Mi she'amar hareini nazir, v'shama chaveiro v'amar va'ani, va'ani - kulam nezirim" - one who said, "I am hereby a nazir," and his friend heard him and said, "And I," and a third said, "And I" - they are all nezirim. One man accepted nezirus upon himself; his friend heard and said "And I," meaning, I too wish to be a nazir like him; and a third heard the second and said "And I" - I too am like him. All of them are nezirim.
From here the Mishnah turns to the law of releasing these vows, since each of them attached his nezirus to the one before him:
"Hutar harishon - hutru kulam": if the first man, who said "I am hereby a nazir," had his vow released and ceased to be a nazir, they are all released, since they all attached themselves to his nezirus.
"Hutar ha'acharon - ha'acharon mutar v'chulam asurin": if it was specifically the last one who said "And I" who had his vow released, he alone is released and all the others remain bound, since they did not attach themselves to him; rather, he attached himself to them.
Other expressions of attaching oneself to a friend's nezirus:
"Amar hareini nazir, v'shama chaveiro v'amar pi k'fiv us'ari kis'aro - harei zeh nazir" - here the friend did not say "And I," but rather used a phrase of comparison: "pi k'fiv" - my mouth is like his mouth with regard to drinking wine, "us'ari kis'aro" - and my hair is like his hair with regard to cutting it. With this wording too he is considered a nazir.
It is worth noting that there is an opinion holding that he must express both details with his mouth - the mouth like his mouth regarding wine and the hair like his hair regarding cutting; and there are those who understand that stating one of them is enough, since the other is automatically understood as well.
A husband and wife who attached their nezirus to one another:
"Hareini nazir, v'sham'ah ishto v'amrah va'ani - meifer es shelah v'shelo kayam": the husband accepted nezirus upon himself, and his wife attached herself to him and said, "And I." The husband may annul her vow, and his own vow remains in force, since he did nothing to encourage her vow and nothing to uphold it - she is the one who responded to his words, and not the reverse.
"Hareini nezirah, v'shama ba'alah v'amar va'ani - eino yachol l'hafer": when the wife is the one who began and said, "I am hereby a nezirah," and her husband heard and said, "And I," he can no longer annul her vow, because by saying that he too wishes to be a nazir he upheld and confirmed her vow, and once he has upheld it, he no longer has the power to annul it.
In summary: in this Mishnah we learned that one who attaches his nezirus to his friend's nezirus is a nazir, and that the law of release depends on the order: releasing the first releases them all, whereas releasing the last releases him alone. We also learned that the wording "my mouth is like his mouth and my hair is like his hair" is effective for accepting nezirus, and that with a husband and wife everything depends on who vowed first: a wife who attached herself to her husband - her husband annuls her vow and his own vow stands; but a husband who attached himself to his wife's vow has thereby upheld her vow, and he can no longer annul it.