partition using rank