There is another fascination in Singapore Zoo: The Infinite Zoo. The Infinite Zoo can be addressed by a chart with a limitless number of vertices marked 1,2,3,… . There is a guided edge from vertex u to vertex u+v if and provided that u&v=v, where and indicates the bitwise AND activity. There could be no different edges in the chart. Animal specialist has q
Correct answer will be upvoted else downvoted. Computer science.
There is another fascination in Singapore Zoo: The Infinite Zoo.
The Infinite Zoo can be addressed by a chart with a limitless number of vertices marked 1,2,3,… . There is a guided edge from vertex u to vertex u+v if and provided that u&v=v, where and indicates the bitwise AND activity. There could be no different edges in the chart.
Animal specialist has q inquiries. In the I-th question she will inquire as to whether she can venture out from vertex ui to vertex vi by going through coordinated edges.
Input
The main line contains an integer q (1≤q≤105) — the number of inquiries.
The I-th of the following q lines will contain two integers ui, vi (1≤ui,vi<230) — an inquiry made by Zookeeper.
Output
For the I-th of the q inquiries, output "YES" in a solitary line if Zookeeper can head out from vertex ui to vertex vi. In any case, output "NO".
You can print your reply regardless. For instance, in the event that the appropriate response is "YES", the output "Yes" or "yeS" will likewise be considered as right reply.
Step by step
Solved in 3 steps with 1 images