

Asked in Phone Pe OA, can any one provide the logic or solution for the question...
source link: http://codeforces.com/blog/entry/108493
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

By ris_maheswari, 10 hours ago,
Xan, the witch, stays in a town that is in the form of a grid. The rows go from 1...10^ 18 and columns go from 1...10^18. Xan lives in a house in a cell (1, 1). Xan can perform witchcraft on a particular day only if she is able to get the magical plant. The magical plant grows in a cell (A, B) on in day. But there are certain rules of the town that she needs to follow :
She starts everyday from her home cell which is (1.1).
She can move from cell (i,j) to either (2*i,j) or (i,2*j) or (i-j,j) or (i,j-i).
She can't move outside the grid.
There are n days and n locations of the magical plant. Xan asks your help to find out if she can perform witchcraft on each day.
Input format
The first line contains number of days, a single integer n The next n lines contain coordinates of the magical plant on that day, two space separated integers.
Output format
For each of the in days, print "Yes" if Xan will be able to perform witchcraft or else print "No"
Constraints
1 <= n <= 3*10^5
T <= i,j <= 10^18
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK