#include <iostream>
#include <vector>

int main() {
  int q;
  std::cin >> q;
  std::vector<int> a;

  for (int i = 0; i < q; ++i) {
    int c;
    std::cin >> c;
    switch (c) {
    case 0:
      int x;
      std::cin >> x;
      a.push_back(x);
      break;
    case 1:
      int p;
      std::cin >> p;
      std::cout << a.at(p) << std::endl;
      break;
    case 2:
      a.pop_back();
      break;
    }
  }
}

