Dadas wrote code that processes the following query in time. Your task is to do the same.
Let the current sequence be . If a value exists in the sequence, define as the unique position satisfying .
A query gives two integers and and is processed as follows.
Equivalently, if the interval immediately before the query is
then immediately after the query it becomes
The initial sequence is . Find the sequence after processing all queries.
The input is given from Standard Input in the following format:
case case
For each test case, print the sequence after processing all queries on one line. Separate consecutive elements with spaces.
In the first test case, the sequence becomes after the first query. It returns to after the second query, and becomes after the last query.
Each case is given in the following format:
The -th query is given by two integers and . Every query satisfies the guarantees in the statement with respect to the current sequence immediately before that query.
| 3 | 27 | The sum of over all test cases does not exceed . |
| 4 | 46 | No additional constraints. |