#K63207. Library Borrowing Tracker

    ID: 31702 Type: Default 1000ms 256MiB

Library Borrowing Tracker

Library Borrowing Tracker

This problem requires you to determine which books remain borrowed at the end of the day in a library. You will be given a series of transactions. Each transaction consists of a book ID and a student ID. A positive book ID indicates a checkout, while a negative book ID indicates a return. The task is to output the list of unique book IDs that are still checked out, sorted in ascending order.

The update rule can be described using the following formula in LaTeX:

$$B = \begin{cases} B \cup \{b\} & \text{if } b > 0,\\ B \setminus \{|b|\} & \text{if } b < 0. \end{cases} $$

If no books are currently borrowed, output an empty line.

inputFormat

The first line of input contains an integer \(n\) representing the number of transactions. Each of the following \(n\) lines contains two space-separated integers: the first integer denotes the book ID and the second denotes the student ID. A positive book ID indicates a checkout, while a negative book ID indicates that a book is returned (with the absolute value representing the book ID).

outputFormat

Output a single line with the list of unique book IDs that remain borrowed, sorted in ascending order and separated by a space. If no books are borrowed, output an empty line.

## sample
5
1 101
2 102
-1 101
3 103
-2 102
3