When the Ritsuryō legal system was starting to be enforced in Japan at the end of the 7th century, it included, as in Tang China, a division between those two major castes.
wˌɛn ðə ɹˈɪtsɚɹɪˌoʊ lˈiːɡəl sˈɪstəm wʌz stˈɑːɹɾɪŋ təbi ɛnfˈoːɹst ɪn dʒəpˈæn æt ðɪ ˈɛnd ʌvðə sˈɛvənθ sˈɛntʃɚɹi, ɪɾ ɪŋklˈuːdᵻd, æz ɪn tˈæŋ tʃˈaɪnə, ɐ dᵻvˈɪʒən bᵻtwˌiːn ðoʊz tˈuː mˈeɪdʒɚ kˈæsts.