Kept median-of-three partition