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.
- Both and exist in the current sequence, and is guaranteed.
- Multiply every element in the interval by , then reverse the order of that interval.
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.
Input
The input is given from Standard Input in the following format:
case case case
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.
Output
For each test case, print the sequence after processing all queries on one line. Separate consecutive elements with spaces.
Constraints
- .
- .
- .
- ().
- and ().
- Immediately before the -th query, both and exist in the current sequence and ().
- The sum of over all test cases does not exceed .
- The sum of over all test cases does not exceed .
Subtasks
Samples
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.