#include<iostream>
#include<vector>

using namespace std;

int main() {
	int n, a, b;
	vector<int> v;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a;
		if (a == 0) {
			cin >> b;
			v.push_back(b);
		}
		else if (a == 1) {
			cin >> b;
			cout << v[b] << endl;
		}
		else {
			v.pop_back();
		}
	}
	return 0;
}
