Kiddushin 69 - Ten Genealogical Classes
According to Rabbi Tarfon, a mamzer can marry a slavewoman, have children with her who get her status of slaves, then free them, and they become free Jews and not mamzerim. However, Rabbi Eliezer says that the children are still mamzerim.
Ten genealogical classes went up from Babylonia to Israel: Kohanim, Leviim, Israelim, Chalalim (disqualified Kohanim), converts, freed Canaanite slaves, mamzerim (illegitimate), Netinim (Gibeonites), Shetukim (whose mother silences him about the father) and Asufim (foundlings, or ones gathered in).
Kohanim, Levvim, and Yisraelim are permitted to marry each other. Leviim, Israelim, chalalim, converts and freed slaves are permitted to marry each other.
Art: A Childrens's Party by Walter Frederick Osborne