generator for max() min()