#include using namespace std; int inf = 1001001001; template struct SegmentTree { int n; vector dat; SegmentTree() {} SegmentTree(int N) { n = 1; while(n < N) { n *= 2; } dat.resize(2*n-1,{-inf,-inf}); } void update(int x, long long val,int val2) { x += (n-1); dat[x].first = val; dat[x].second = val2; while(x > 0) { x = (x-1)/2; dat[x] = max(dat[2*x+1],dat[2*x+2]); } } T query(int a, int b, int k, int l, int r) { if(r <= a || b <= l) return {-inf,-inf}; if(a <= l && r <= b) return dat[k]; T vl = query(a, b, 2*k+1, l, (l+r)/2); T vr = query(a, b, 2*k+2, (l+r)/2, r); return max(vl, vr); } T query(int a,int b) {//[a,b) return query(a,b,0,0,n); } }; int main() { long long N,M; cin >> N >> M; vectora(M); SegmentTree>Seg(M); for(int i = 0; i < M; i++) { cin >> a[i]; Seg.update(i,a[i],i); } int Q; cin >> Q; while (Q--) { long long t,x,y; cin >> t >> x >> y; x--; if(t == 1) { a[x] += y; Seg.update(x,a[x],x); } if(t == 2) { a[x] -= y; Seg.update(x,a[x],x); } if(t == 3) { cout << Seg.query(0,M).second+1 << endl; } } }