The correspondence between x and y needs to be maintained in the sort.