#include <iostream>
#include<vector>
using namespace std;
vector<int> v;
int main()
{
    int n;
    cin>>n;
    while(n--){
        int tip,a;
        cin>>tip;
        if(tip==0){
            cin>>a;
            v.push_back(a);
        }
        else if(tip==1){
            cin>>a;
            cout<<v[a]<<endl;
        }
        else{
            v.pop_back();
        }
    }


}

