#include<iostream>
#include<vector>
using namespace std;

int main()
{
    int n;
    int order, val;
    vector<int> a;

    cin >> n;

    for( int i = 0; i < n; i++ )
    {
        cin >> order;
        if( order == 0 )
        {
            cin >> val;
            a.push_back(val);
        }
        else if( order == 1 )
        {
            cin >> val;
            cout << a[val] << endl;
        }
        else
            a.pop_back();
    }

    return 0;
}
