A utility for partitioning a set into three sets