Equipartite colorings in graphs and hypergraphs