Sorting lines