sort cohorts logically