Cavity Sorting