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

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

	}



	return 0;
}

