#include #include using namespace std; using namespace atcoder; int op(int a,int b){ return max(a,b); } int e(){ return -1; } int main(){ segtree seg(3e5); int q; cin >> q; int i = 0; while(q--){ int t,x; cin >> t >> x; if(t == 1){ i++; seg.set(i,x); } else{ cout << seg.prod(i-x+1,i + 1) << endl; } } cout << endl; }