complete Sorting a Three-Valued Sequence