fast: sort by height before sorting by slopes. mergesort is stable