import scala.collection.mutable.ArrayBuffer
import scala.io.StdIn

object Main extends App {


  //val a = List.empty[Int]
  val a = ArrayBuffer.empty[Int]

  // 2,147,483,647
  def pushBuck(x: Int) = a.append(x)

  def popBuck() = if(a.nonEmpty) a.remove(a.size - 1)

  def randomAccess(i: Int): Int = a(i)

  val q = StdIn.readLine().trim.toInt
  (0 until q).foreach { i =>
    val input = StdIn.readLine()
    val temp = if (input.startsWith("2")) Array(2, 0) else input.split(' ').map(_.toInt)
    val (cmd, x): (Int, Int) = (temp(0), temp(1))

    cmd match {
      case 0 =>
        pushBuck(x)
      case 1 => println(randomAccess(x))
      case 2 =>
        popBuck()
    }
  }
}

