Sorting X  and Y