Alignment and Sorting by Path Lord