#7. 焚音打
焚音打
Problem Statement
You have lights numbered from to , 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 and press each light's switch sequentially.
When pressing the switch for the -th light, the following rules are executed in order:
- The state of the -th light changes.
- You will also press the switches of lights numbered 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 and , you need to determine whether the -th light is on or off after completing the above process.
Input Format
The first line contains a positive integer , indicating there are test cases ().
The next lines each contain two integers and , indicating whether the -th light is on after operating on lights ().
Output Format
Output lines, each with the result. For each test case, if the -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 :
- When , there is only one light. After pressing it, the light is on, so the output is
YES. - When , after pressing light , you need to press lights and . Then you press light . Finally, light is off, so the output is
NO.
- When , there is only one light. After pressing it, the light is on, so the output is
相关
在下列比赛中: