#include using namespace std; using ll = long long; #define rep(i, s, e) for (int i = (int)(s); i < (int)(e); ++i) int main() { cin.tie(nullptr); ios_base::sync_with_stdio(false); int N, K, Q; cin >> N >> K >> Q; priority_queue small; priority_queue, greater> large; rep(i, 0, N) { ll A; cin >> A; small.push(A); if (small.size() > K) { large.push(small.top()); small.pop(); } } rep(query, 0, Q) { int t; cin >> t; if (t == 1) { ll x; cin >> x; small.push(x); large.push(small.top()); small.pop(); } else if (t == 2) { ll y; cin >> y; y += small.top(); if (large.empty()) { small.pop(); small.push(y); } else { small.pop(); small.push(large.top()); large.pop(); small.push(y); large.push(small.top()); small.pop(); } } else { cout << small.top() << '\n'; } } }