Getting the min and the max of queue in O(logn) while having an efficient insertion and removal.