#C9932. Theater Booking Manager

    ID: 54080 Type: Default 1000ms 256MiB

Theater Booking Manager

Theater Booking Manager

You are in charge of managing booking requests for a theater that has a single row of seats. The theater has n seats numbered from 1 to n.

Each booking request consists of two integers: the size of the group k and the requested starting seat index i. A booking request is successful if and only if there exists a contiguous block of k unoccupied seats starting from seat i (i.e. seats i, i+1, …, i+k-1), and all these seats are available at the time of the request. If the booking is successful, these seats become occupied and the result for that booking is True; otherwise, the request is rejected and the result is False.

The constraint for a valid booking can be formally described by the inequality: \( i + k - 1 \le n \).

You need to process multiple booking requests sequentially and output whether each booking request is successful.

inputFormat

The input is read from stdin and has the following format:

n m
k1 i1
k2 i2
... 
km im

Here, n is the total number of seats, m is the number of booking requests, and each of the following m lines contains two integers:

  • k - the size of the group (i.e., the number of consecutive seats requested).
  • i - the starting seat index for the booking request.

outputFormat

For each booking request, output a line containing True if the booking can be accommodated, or False otherwise. The outputs should be printed on separate lines to stdout.

## sample
10 4
2 1
3 3
2 6
1 9
True

True True True

</p>