#K60692. Race Checkpoint Challenge

    ID: 31143 Type: Default 1000ms 256MiB

Race Checkpoint Challenge

Race Checkpoint Challenge

You are given a circular track with n checkpoints. There are m runners, each starting from a specified checkpoint and having a certain amount of energy. In order for a runner to successfully complete a full lap of the track, his energy must be at least n (i.e. \(E \ge n\)). Otherwise, the runner will not have enough energy to reach all checkpoints.

Each runner is described by two integers:

  • a: the starting checkpoint (provided for information and does not affect the outcome), and
  • e: the energy available to that runner.

Your task is to determine for each runner whether he can complete the full lap. If his energy is at least n, print YES; otherwise, print NO.

inputFormat

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

T
n1 m1
 a1,1 e1,1
 a1,2 e1,2
 ...
 a1,m1 e1,m1
n2 m2
 a2,1 e2,1
 ...
 a2,m2 e2,m2
...

Here, T is the number of test cases. For each test case, the first line contains two integers n (the number of checkpoints) and m (the number of runners). This is followed by m lines, each containing two integers representing a runner's starting checkpoint and his energy.

outputFormat

For each test case, output exactly m lines. Each line should contain the string YES if the corresponding runner's energy is at least n (i.e., \(e \ge n\)); otherwise, output NO. The results for different test cases should be printed consecutively in the order of input.

## sample
2
5 3
1 4
3 2
5 1
4 2
2 0
1 5
NO

NO NO NO YES

</p>