וַיֹּ֖אמֶר אָר֣וּר כְּנָ֑עַן עֶ֥בֶד עֲבָדִ֖ים יִֽהְיֶ֥ה לְאֶחָֽיו׃
און ער האָט געזאָגט: פֿאַרשאָלטן זאָל זײַן כּנַעַן, אַ קנעכט פֿון קנעכט זאָל ער זײַן בײַ זײַנע ברידער.
Mishnah Horayot
A priest takes precedence over a levite, a levite over an israelite, an israelite over a mamzer, a mamzer over a natin, a natin over a convert, and a convert over a freed slave. When is this so? When all these were in other respects equal. However, if the mamzer was a scholar and the high priest an ignoramus, the scholar mamzer takes precedence over the ignorant high priest.