min max pq with median