#include #include #include #include #include #include #include #include #include #include #include #include using namespace std; using ll = long long; int main(){ ll N, M, Q, t, x, y; cin >> N >> M; vector cnt(M+1); multiset> st; for (int i=1; i<=M; i++) cin >> cnt[i]; for (int i=1; i<=M; i++) st.insert({cnt[i], i}); cin >> Q; while(Q){ Q--; cin >> t >> x >> y; if (t == 1){ st.erase({cnt[x], x}); cnt[x] += y; st.insert({cnt[x], x}); } else if (t == 2){ st.erase({cnt[x], x}); cnt[x] -= y; st.insert({cnt[x], x}); } else cout << st.rbegin()->second << endl; } return 0; }