At kyu and Dan rank, it goes by who received their rank first. For example, if you have on any given testing day, 4 people who were going for blue belt, the individual who had his blue belt put on him first, was the first to stand in line of blue belt ranks. This also goes for black belt testings. Whoever was promoted first to their Dan level, stands in line closer to the head instructor (to his left.) Hope my explaination makes sense. Also recognized mostly at Black Belt level, the Head Instructor bows, kneels, sits and stands first. We follow a split second behind. All a ranks, as a sign of respect, higher ranks go through doors first.