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

int main(){
  vector<long long> v;
  long long q, a, b;
  cin >> q;
    while(q--){
      cin >> a;
      if(a != 2){
        cin >> b;
        if(a == 0) v.push_back(b);
        else cout << v.at(b) << endl;
      }
      else v.pop_back();
    }
}
