Sort by UID and SEQUENCE, and sort duplicates stably rather than removing them.