Order country preferences by school, then rank.

Fixes #326.