• + 0 comments

    import heapq q = int(input()) heap = [] dic = {} for _ in range(q): query = input() if query[0] == '1': query = query.split() heapq.heappush(heap,int(query[1])) elif query[0] == '2': query = query.split() dic[int(query[1])] = 1 while len(heap) > 0 and heap[0] in dic: heapq.heappop(heap)

    else:
        print(heap[0])