Vrsta
면접 대비시간 제한1초메모리 제한1024 MB
매 문장마다 키 v_i인 학생 a_i명이 추가될 때, 줄의 가운데에 서는 학생의 키를 출력한다. 가운데가 둘이면 더 작은 쪽을 택한다.
문제
Domagoj’s favorite school subject is P.E. Every P.E. class starts with warm-up exercises. The teacher has an interesting way of choosing the student who will lead the warm-up. The students stand in a line sorted by their height. The teacher will choose the student that is standing in the middle of the line. If two students are in the middle, he will choose the shorter one. For example: if the students have heights , the student with height will lead the warm-up exercises.
Domagoj does not remember how tall his classmates are. Luckily, next to him stands Lovro who is very good at estimating people’s heights. He gives Domagoj statements: “There are students entering the gym with height ”. After every statement said by Lovro, Domagoj is interested in the height of the student who will lead the warm-up, if only the students who entered the gym come to P.E. class. Help him answer his questions!
입력
The first line contains the integer (), the number of Lovro’s statements.
The following lines contain two integers , (), the height and the number of students in Lovro’s statement.
출력
In the -th of lines output the answer to Domagoj’s question after of Lovro’s statements.