시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 1024 MB111100.000%

## 문제

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 $1$ $3$ $5$ $7$ $11$, the student with height $5$ 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 $n$ statements: “There are $a_i$ students entering the gym with height $v_i$”. 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 $n$ ($1 ≤ n ≤ 200\,000$), the number of Lovro’s statements.

The following $n$ lines contain two integers $v_i$, $a_i$ ($1 ≤ v_i , a_i ≤ 10^9$), the height and the number of students in Lovro’s statement.

## 출력

In the $i$-th of $n$ lines output the answer to Domagoj’s question after $i$ of Lovro’s statements.

## 서브태스크

번호배점제한
119

$n, v_i ≤ 1\,000$

226

$a_1 = a_2 = \dots = a_n = 1$

329

$v_1 < v_2 < \dots < v_n$

436

## 예제 입력 1

3
2 1
3 1
1 1


## 예제 출력 1

2
2
2


## 예제 입력 2

4
17 2
23 5
11 4
9 5


## 예제 출력 2

17
23
17
11


## 예제 입력 3

3
10 20
100 5
1000 5


## 예제 출력 3

10
10
10


## 채점 및 기타 정보

• 예제는 채점하지 않는다.