((stdin) => {
  const lines = stdin.trim().split('\n');
  let q = Number(lines.shift());
  const result = [];
  const arr = [];
  const args = lines.map((line) => line.split(' ').map(Number));
  for (const [ops, p] of args) {
    if (ops === 0) {
      arr.push(p);
    } else if (ops === 1) {
      result.push(arr[p]);
    } else {
      arr.pop();
    }
  }
  console.log(result.join('\n'));
})(require('fs').readFileSync('/dev/stdin', 'utf8'));
