object Main extends App {
    val in = io.Source.stdin.getLines.map(_.split(" ").map(_.toInt))
    val x = List(Array(0, in.next.head-1, 2147483647))
    in.foldLeft(x)((qs, q) => q match {
        case Array(0, _*) => q.tail +: qs
        case Array(1, i) => {
            println((qs.find(y => y(0) <= i && y(1) >= i).get)(2))
            qs
        }
    })
}