Sorting paths