Japan’s system of court ranks began with the kan’i jūnikai, the twelve cap ranks of 603. A Japanese encyclopedia explains that it sought to express the order of officials by the color of the caps they wore.
The twelve ranks were named for six virtues: toku, jin, rei, shin, gi and chi. Virtue, benevolence, propriety, faith, righteousness and wisdom. Each was divided into a greater and a lesser rank.