#include <bits/stdc++.h>
using namespace std;
int main(){
    int q;
    cin >> q;
    vector<int> a;
    while(q--){
        int u;
        cin >> u;
        if(u == 0) {
            int x;
            cin >> x;
            a.push_back(x);
        }else if(u == 1) {
            int p;
            cin >> p;
            cout << a[p] << '\n';
        }else{
            a.pop_back();
        }
    }
}
