וַיֹּ֖אמֶר אָר֣וּר כְּנָ֑עַן עֶ֥בֶד עֲבָדִ֖ים יִֽהְיֶ֥ה לְאֶחָֽיו׃
이에 가로되 가나안은 저주를 받아 그 형제의 종들의 종이 되기를 원하노라
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.