Generalize bucketing according to first element.