#7. 焚音打

焚音打

Problem Statement

You have nn lights numbered from 11 to nn, and initially, all of them are turned off.

Each light has two states: on or off. Each time you press a light's switch, its state will change. If it was on, it will turn off; if it was off, it will turn on.

You plan to start from light 11 and press each light's switch sequentially.

When pressing the switch for the ii-th light, the following rules are executed in order:

  1. The state of the ii-th light changes.
  2. You will also press the switches of lights numbered 2i,3i,2i, 3i, \dots in sequence, and their states will also change. (These operations are also considered pressing a light switch and will trigger the two rules, causing a chain reaction)

Given multiple test cases, each containing two integers nn and kk, you need to determine whether the kk-th light is on or off after completing the above process.

Input Format

The first line contains a positive integer TT, indicating there are TT test cases (1T1051 \leq T \leq 10^5).

The next TT lines each contain two integers nn and kk, indicating whether the kk-th light is on after operating on nn lights (1kn1061 \leq k \leq n \leq 10^6).

Output Format

Output TT lines, each with the result. For each test case, if the kk-th light is on, output YES; otherwise, output NO.

The output can be in any case-insensitive form (e.g., "yEs", "yes", "Yes", and "YES" are all acceptable).

Sample #1

Sample Input #1

2
1 1
3 2

Sample Output #1

YES
NO

Hints

  • For the example with T=2T=2:
    • When n=1n=1, there is only one light. After pressing it, the light is on, so the output is YES.
    • When n=3n=3, after pressing light 11, you need to press lights 22 and 33. Then you press light 22. Finally, light 22 is off, so the output is NO.