function to split list of labels for balancing