#include<bits/stdc++.h>
using namespace std;


int main(){
    int n;
    cin >> n;
    vector<int> a;
    for(int i=0;i<n;++i){
        int q;
        cin >> q;
        if(q==0){
            int x;
            cin >> x;
            a.push_back(x);
        }else if(q==1){
            int x;
            cin >> x;
            cout << a[x] << endl;
        }else{
            a.pop_back();
        }
    }
    return 0;
}
