import heapq n, k, q = map(int, input().split()) a = list(map(int, input().split())) hq = [] hq2 = [] for x in a: heapq.heappush(hq, x) if len(hq) > n - k + 1: heapq.heappush(hq2, -heapq.heappop(hq)) for _ in range(q): s = input() if s[0] == "1": _, x = map(int, s.split()) heapq.heappush(hq, x) if hq[0] < -hq2[0]: heapq.heappush(hq, -heapq.heappop(hq2)) heapq.heappush(hq2, -heapq.heappop(hq)) elif s[0] == "2": _, y = map(int, s.split()) heapq.heappush(hq, heapq.heappop(hq) + y) else: print(hq[0])