h = {}

STDIN.gets.to_i.times do
  q = STDIN.gets.split
  case q[0]
  when '0' then
    h[h.length.to_s] = q[1]
  when '1' then
    puts h[q[1]]
  when '2' then
    h.delete((h.length - 1).to_s)
  end
end

