precedence within each grade is dictated by dates of appointment, save for those in grade i who are either a head of state or a member of the royal family of a commonwealth realm, another commonwealth country, or foreign state, in which case they all precede the other members of the grade in the following order: