Sorting points by coordinates