build minmax