3way qsort