Turjo is managing the front counter at Akibdonalds. He has exactly $$$N$$$ pagers on his charging rack, numbered from $$$1$$$ to $$$N$$$.
A group of $$$k$$$ customers ($$$k \ge 1$$$) must receive $$$k$$$ consecutive pager IDs so that Turjo can carry them on one tray.
For every arriving group, Turjo chooses the smallest possible starting ID $$$l$$$ such that all pagers
$$$$$$ l,l+1,\dots,l+k-1 $$$$$$
are currently available.
When the customers' food is ready, they return their pagers to Turjo, making those pagers available again. The returned pagers always form a consecutive range.
You are given a sequence of $$$Q$$$ events in chronological order. Simulate Turjo's actions and determine which pager IDs each arriving group receives.
The first line contains two integers $$$N$$$ and $$$Q$$$.
The next $$$Q$$$ lines describe the following events.
It is guaranteed that $$$1 \leq k \leq N$$$.
It is guaranteed that $$$1 \leq l \leq r \leq N$$$, and every pager in this range is currently being held by a customer.
All group arrivals can be fulfilled using the currently available pagers.
Print the answers in chronological order.
Constraints
| Subtask | Points | $$$\boldsymbol{N}$$$ | $$$\boldsymbol{Q}$$$ | $$$\boldsymbol{k}$$$ | Additional Constraints |
| 0 | 0 | – | – | – | The examples |
| 1 | 5 | $$$=1$$$ | $$$\le 200000$$$ | $$$=1$$$ | All events involve the only pager. |
| 2 | 15 | $$$\le 5000$$$ | $$$\le 5000$$$ | $$$1 \le k \le N$$$ | No additional constraints. |
| 3 | 15 | $$$\le 200000$$$ | $$$\le 200000$$$ | $$$=1$$$ | There are no Type 2 queries. |
| 4 | 25 | $$$\le 200000$$$ | $$$\le 200000$$$ | $$$\le 3$$$ | No additional constraints. |
| 5 | 40 | $$$\le 200000$$$ | $$$\le 200000$$$ | $$$1 \le k \le N$$$ | No additional constraints. |
6 71 11 22 1 11 22 4 51 31 1
1 2 3 4 5 4 6 1
Examples
Example 1
Input
6 7
1 1
1 2
2 1 1
1 2
2 4 5
1 3
1 1
Output
1
2 3
4 5
4 6
1
Explanation
There are $$$6$$$ pagers, numbered from $$$1$$$ to $$$6$$$.
We process the events one by one:
Pagers $$$2$$$ and $$$3$$$ are the smallest consecutive available pagers, so they receive $$$2,3$$$.
Pager $$$1$$$ becomes available again.
Pagers $$$4$$$ and $$$5$$$ are the smallest consecutive available pagers, so they receive $$$4,5$$$.
Therefore, both pagers $$$4$$$ and $$$5$$$ become available again.
At this moment, the available pagers are
[ 1,4,5,6. ]
The smallest three consecutive available pagers are $$$4,5,6$$$, so the group receives $$$4,5,6$$$.
Therefore, we print:
4 6
Pager $$$1$$$ is the smallest available pager, so the customer receives pager $$$1$$$.
Thus the complete output is:
1
2 3
4 5
4 6
1
| Name |
|---|


