import scala.collection.mutable.ArrayBuffer
import scala.io.StdIn.{readInt, readLine}

object Main extends App {
  val pushBack     = 0
  val randomAccess = 1
  val popBack      = 2

  val n     = readInt()
  val lines = Iterator.fill(n)(readLine())

  val orders = lines.map { _.split(" ").map { _.toInt } }
  var xs     = Vector[Int]()
  orders.foreach {
    case Array(`pushBack`, x)     => xs = xs :+ x
    case Array(`randomAccess`, x) => println(xs(x))
    case Array(`popBack`)         => xs = xs.init
  }
}

