#include #include //小数点出力用 //cout << fixed << setprecision(10) << ans; #include #include #include #include #include #include #include #include using ll = long long; using namespace std; #define modPHash (ll)((1LL<<61)-1) #define modP (ll)998244353 bool chkrng0idx(int pos, int sup) { return (0 <= pos && pos < sup); } int clk4(int num) { return (num - 2) * (num % 2); } void yn(bool tf) { cout << (tf ? "Yes\n" : "No\n"); } int main() { cin.tie(nullptr); ios::sync_with_stdio(false); int N; cin >> N; vector>V; int C = 0; while (N--) { int T, X; cin >> T >> X; if (T == 1) { while (V.size() > 0 && V[V.size() - 1].second < X) { V.pop_back(); } V.push_back({C, X}); C++; } else { auto itr = lower_bound(V.begin(), V.end(), make_pair( C - X,-1 )); cout << (*itr).second << "\n"; } } }