#include using namespace std; using ll =long long; void solve(){ ll Q; cin>>Q; vector> B; ll cnt=0; for(int i=0;i>t>>x; if(t==1){ while(B.size()>0&&B.back()[1]<=x)B.pop_back(); B.push_back({cnt,x}); cnt++; } else{ array P={cnt-x,ll(-1e18)}; auto p=lower_bound(B.begin(),B.end(),P); cout<<(*p)[1]<<"\n"; } } } int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); int T=1; // cin>>T; while(T--)solve(); }