Lexicographic Sort