#include using namespace std; using ll = long long; int main() { ll N, K, Q; cin >> N >> K >> Q; vector A(N); for (int i = 0; i < N; ++i) cin >> A[i]; sort(A.begin(), A.end()); multiset pq1, pq2; auto push = [&](ll x) { if (pq1.size() < K) { pq1.insert(x); } else { if (*pq1.rbegin() <= x) { pq2.insert(x); } else { pq2.insert(*pq1.rbegin()); pq1.erase(prev(pq1.end())); pq1.insert(x); } } }; for (int i = 0; i < N; i++) { push(A[i]); } while (Q--) { ll t; cin >> t; if (t == 1) { ll x; cin >> x; push(x); } else if (t == 2) { ll x; cin >> x; auto it = prev(pq1.end()); ll k = *it; if (pq2.empty()) { pq1.erase(it); pq1.insert(x + k); continue; } if (*pq2.begin() < k + x) { pq1.erase(prev(pq1.end())); pq1.insert(*pq2.begin()); pq2.erase(pq2.begin()); pq2.insert(x + k); } else { pq1.erase(prev(pq1.end())); pq1.insert(x + k); } } else { cout << *pq1.rbegin() << "\n"; } } return 0; }