#include using namespace std; typedef long long ll; typedef long double ld; #define REP(i, n) for (int i = 0; i < (n); ++i) #define REPR(i, n) for (int i = n - 1; i >= 0; --i) #define FOR(i, m, n) for (int i = m; i < n; ++i) #define FORR(i, m, n) for (int i = m; i >= n; --i) #define ALL(v) (v).begin(),(v).end() templatebool chmax(T &a, const T &b) { if (abool chmin(T &a, const T &b) { if (b> n >> m; vector a(m); set> st; REP(i,m){ cin >> a[i]; st.insert({a[i],i+1}); } ll q;cin >> q; while(q--){ ll t,x,y;cin >> t >> x >> y; if(t==1){ st.erase({a[x-1],x}); st.insert({a[x-1]+y,x}); a[x-1]+=y; } else if(t==2){ st.erase({a[x-1],x}); st.insert({a[x-1]-y,x}); a[x-1]-=y; } else{ auto itr=--st.end(); auto [u,v]=*itr; cout << v << endl; } } }