Kiddushin, Chapter 4, Mishnah 1. This mishnah deals with the various categories of lineage and disqualified lineage that exist in halachah, and presents them in a historical setting: ten categories of lineage came up from Bavel to Eretz Yisrael when Ezra and part of the nation returned to the land to begin building the Second Beis HaMikdash.
The historical background:
Ezra brought up with him all the Torah scholars and learned men, and as a result there was no longer sufficient scholarship left in Bavel to rely upon in determining who is fit to marry into the community and who is permitted to marry whom. Therefore, as a precaution, Ezra brought up with him all the categories of those with flawed lineage, so that the scholars would be able to rule on who is permitted to marry whom. This is what the mishnah means when it says that ten categories of lineage came up with him from Bavel - and not all of them are disqualified, as we will see.
"Asarah yuchsin alu miBavel" (Ten categories of lineage came up from Bavel):
Kohanim - some of the kohanim came up.
Leviim - although there is discussion about this, the fact is that the Leviim did not come up; possibly only some of them came up, or they did not come up willingly.
Yisraelim - an ordinary Yisrael, an ordinary Jew.
Chalalim - those born from unions forbidden to a kohen, from a marriage between a kohen and a woman who is forbidden to him.
Geirim - people who converted.
Charurei - freed slaves, who also have the status of converts.
Mamzerim - those who come from forbidden relationships, from arayos or from adultery.
Nesinim - a group of people who converted even though they should not have been accepted: they deceived the leaders of the Jewish people in the days of Yehoshua and claimed that they were not from the seven nations that we were commanded to wipe out. Their conversion took effect, but they were given a status that forbids marrying them into the Jewish people.
Shetuki and asufi - people who are of doubtful mamzer status. The precise difference between these two categories will be clarified later on.
Who may marry whom:
"Kahanei, Levi'ei, Yisre'elei - mutarin lavo zeh bazeh" - these three groups are permitted to marry one another.
"Levi'ei, Yisre'elei, Chalalei, Geirei v'Charurei - mutarin lavo zeh bazeh" - here the mishnah leaves the kohanim out, and lists the Leviim, the Yisraelim, the chalalim who come from unions forbidden to a kohen, the converts, and the freed slaves whose law is like that of converts. All of these are permitted to marry one another. The only ones who cannot marry from this group are the kohanim, since a kohen cannot marry a convert, cannot marry a freed slave woman whose law is like that of a convert, and cannot marry a chalalah. The Leviim and Yisraelim, by contrast, are permitted to them.
"Geirei v'Charurei, Mamzerei u'Netinei, Shetukei v'Asufei - kulam mutarin lavo zeh bazeh" - the converts and freed slaves, the mamzerim, the Nesinim, and the shetuki and asufi who carry a doubt of mamzerus, are all permitted to marry one another. This ruling follows the opinion that converts and freed slaves are permitted to mamzerim and were not forbidden to them, and this is a matter of dispute.
The Leviim and Yisraelim, on the other hand, cannot marry into this group. True, they are permitted to converts and freed slaves, as we learned earlier in the mishnah, but they are not permitted to mamzerim, to Nesinim, or to the shetuki and asufi who are of doubtful status. One who is a doubtful mamzer, however, is permitted to marry a definite mamzer.
In summary: in this mishnah we learned the ten categories of lineage that came up from Bavel with Ezra, and the reason they were brought up: once Bavel was emptied of Torah scholars, those of flawed lineage had to come up so that the scholars would be able to rule on who is permitted to marry whom. We examined the three permitted groupings in the mishnah: kohanim, Leviim and Yisraelim; Leviim, Yisraelim, chalalim, converts and freed slaves; and the third group of converts and freed slaves together with mamzerim, Nesinim, shetuki and asufi, according to the opinion that converts were not forbidden to mamzerim.