object Main extends App {
    val in = io.Source.stdin.getLines.map(_.split(" ").map(_.toInt))
    val x = scala.collection.mutable.Queue(Array(0, in.next.head-1, 2147483647))
    in.foreach(_ match {
        case q@Array(0, _*) => x.enqueue(q.tail)
        case Array(1, i) => {
            println((x.reverse.find(y => y(0) <= i && y(1) >= i).get)(2))
        }
    })
}