#! /usr/bin/env python3 import heapq N, K, Q = map(int, input().split()) A = list(map(int, input().split())) hq1 = [] hq2 = [] for i, a in enumerate(sorted(A)): if i < K: heapq.heappush(hq1, -a) else: heapq.heappush(hq2, a) for _ in range(Q): q = list(map(int, input().split())) if q[0] == 1: x = q[1] if x < -hq1[0] : y = - heapq.heappop(hq1) heapq.heappush(hq1, -x) heapq.heappush(hq2, y) else: heapq.heappush(hq2, x) elif q[0] == 2: x = q[1] y = -heapq.heappop(hq1) if not hq2: heapq.heappush(hq1, -(x + y)) continue if x + y <= hq2[0]: heapq.heappush(hq1, -(x + y)) else: z = heapq.heappop(hq2) heapq.heappush(hq1, -z) heapq.heappush(hq2, x + y) else: print(-hq1[0])