res = []
gets.chomp.to_i.times do 
    a = gets.chomp.split(" ").map { |i| i.to_i }
    if a[0] == 0
        res.push(a[1])
    elsif a[0] == 2
        res.pop
    elsif a[0] == 1
        puts res[a[1]]
    end
end
