시간 제한메모리 제한제출정답맞힌 사람정답 비율
9 초 2048 MB51133.333%

문제

You and Bob are playing Hyper Smawk Bros against each other, facing a single boss with health $n$.

You and Bob act alternately, and you start. On your turn, you may use an attack that deals an integer amount of damage $x$ in $[1, m]$, replacing $n$ with $n − x$. However, you cannot use the same $x$ that your opponent just used on the previous turn (on the very first move of the game, any $x$ in $[1, m]$ is allowed).

The winner is the first player to reduce the boss’s health to $n ≤ 0$. Determine whether you can force a win if Bob plays optimally.

입력

Each test contains multiple test cases. The first line contains the number of test cases $t$ ($1 ≤ t ≤ 10^4$). The description of the test cases follows.

The only line of each test case contains two integers $n$, $m$ ($1 ≤ n ≤ 10^6$, $2 ≤ m ≤ 10^6$) — the starting health $n$ and the maximum damage per attack $m$.

Note that there are no constraints on the sum of $n$ over all test cases, and there are no constraints on the sum of $m$ over all test cases.

출력

For each test case, output YES if you can force a win against Bob, and NO otherwise.

예제 입력 1

8
6 9
20 10
69 2
42 9
42 10
44 9
44 10
400000 400000

예제 출력 1

YES
YES
NO
NO
YES
YES
NO
YES

In the first test case, you can win immediately by dealing damage $8$, so that $n$ becomes $6 − 8 = −2 ≤ 0$.

In the second test case,

  • you choose to deal damage $10$;
  • Bob can choose to deal any damage in $[1, 10]$ different from $10$;
  • then you can choose to deal damage $10$ and win.

In the third test case,

  • either you start by dealing damage $1$, then Bob must deal damage $2$, then you must deal damage $1$, etc.;
  • or you start by dealing damage $2$, then Bob must deal damage $1$, then you must deal damage $2$, etc.

In both cases, you lose.