Do you know why the fourth floor is locked and the elevator does not stop there? Because, in fact, the fourth, locked floor, where the elevator does not stop, contains an infinite number of rooms, numbered with natural numbers. On this floor, children regularly arrive, each having already chosen which room they want to occupy. If the selected room is vacant, the child occupies it; otherwise, the child occupies the first free room with a larger number. In addition, some children leave in the middle of the session. Immediately after a child departs, their room becomes available.
Simulate the work of the teachers responsible for the fourth floor, and learn how to quickly tell arriving children which room they should occupy.
The first line contains one integer — the number of arrivals and departures occurring during the session (n \le 100\,000).
The next lines contain information about the students. A number a > 0 means that a child arrives and wants to occupy the room with number (a \le 10^6). A number a < 0 means that the child who occupied room number leaves (it is guaranteed that this room was not empty).
For each arriving child, print the room number that they will occupy.
Example 1