The city where Andrea lives is a beautiful place that attracts many tourists. All the tourists will check into the biggest hotel in this city.
The hotel has
The tourists always come in group and when the
The tourists also checkout in group and when the
Please help the hotel deal with these requests. For each check in request, please tell the tourists the number of the leftmost room they can check in.
The first line contains two integers
The following
1 x
: The check in request.2 l r
: The checkout request.
For each check in request, print a line containing one integer, representing the room number of the leftmost room. If there is no room available, please print 0
.
5 5
1 3
1 2
2 3 5
2 1 1
1 3
1
4
3
For 50% testcases:
For all testcases: