three way string sort