import heapq def solve(): n,k,q = map(int, input().split()) a = list(map(int, input().split())) a.sort() small = [-a[i] for i in range(k)] heapq.heapify(small) large = a[k:] heapq.heapify(large) for _ in range(q): query = list(map(int, input().split())) if query[0] == 1: heapq.heappush(small, -query[1]) kth = -heapq.heappop(small) heapq.heappush(large, kth) elif query[0] == 2: old_kth = -heapq.heappop(small) heapq.heappush(large, old_kth + query[1]) new_kth = heapq.heappop(large) heapq.heappush(small, -new_kth) else: print(-small[0]) if __name__ == "__main__": solve()