qmax and qmin for output q