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

int main() {
	int q,t1,t2;
	vector<int> v;
	scanf("%d",&q);
	while(q--){
		if(cin >> t1>>t2){
			if(t1==0)
			{
				v.push_back(t2);
			}
			else if(t1==1)
			{
				cout << v[t2] <<"\n";
			}
		}
		else if(cin >> t1){
			if(t1==2)
			v.pop_back();
		}
		
	}
	return 0;
}
