 let input = require('fs').readFileSync('/dev/stdin', 'utf8').split('\n');
 let num = input[0];

let arr = [];
for (let i=1; i<=num; i++) {
    if (input[i][0] === '0') {
        let tmp = input[i].split(' ');
        arr.push(tmp[1]);
    }
    if (input[i][0] === '1') {
        let tmp = input[i].split(' ').map(Number);
        console.log(arr[tmp[1]]);

    }
    if (input[i][0] === '2') {
        arr.pop();
    }
    
}


