#include #include struct Element{ int val; long long cnt; bool operator < (const Element& other)const{ if(cnt!=other.cnt) return cnt < other.cnt; else return val < other.val; } }; long long time[100005]; int main(){ long long m; int n; scanf("%lld%d",&m,&n); std::priority_queue Q; for(int i = 1; i <= n; i++){ long long cnt; scanf("%lld",&cnt); time[i] = cnt; Q.push(Element{i,cnt}); } int q; scanf("%d",&q); while(q--){ int op; long long x,y; scanf("%d%lld%lld",&op,&x,&y); if(op == 1){ time[x] += y; Q.push(Element{(int)x,time[x]}); } else if(op == 2){ time[x] -= y; Q.push(Element{(int)x,time[x]}); } else{ while(Q.size()!=0 && Q.top().cnt!=time[Q.top().val]) Q.pop(); printf("%d\n",Q.top().val); } } return 0; }