Implement hieararchical ranking.