#include<bits/stdc++.h>
#define loop(vals,times) for(vals=0;vals<times;vals++)
#define reg(time) for(int val=0;val<time;val++)
using namespace std;

int main()
{
    int q,qweri,p;
    vector<int> A(0);
    cin>>q;
    reg(q){
    cin>>qweri;
    if(qweri==0){
     cin>>p;
     A.push_back(p);
    }
    if(qweri==1){
        cin>>p;
        cout<<A.at(p)<<endl;
        if(A.size()==0)break;
    }
    if(qweri==2){
        A.pop_back();
    }
    }
}

