Traversing Grid

All submissions for this problem are available.
Given 2 points in 2 dimensional space (xs,ys) and (xd,yd), your task is to find whether (xd,yd) can be reached from (xs,ys) by making a sequence of zero or more operations.
From a given point (x, y), the operations possible are:
a) Move to point (y, x)
b) Move to point (x, y)
c) Move to point (x+y, y)
d) Move to point (2*x, y)
Input
The first line of input contains T, the number of test cases. T lines follow, one for each test case.
For each test case, the input contains one line denoting the 4 integers xs, ys, xd, yd
Output
Output T lines, one for each test case. For each test case, output "YES" if (xd,yd) is reachable from (xs,ys) and "NO" otherwise. (quotes for clarity)
Example
Input: 1 1 1 2 2 Output: YES Constraints: T <= 25 10^10 <= xs, ys, xd, yd <= 10^10 Note that, although the input values are constrained by the above inequality, the coordinates of the points at the intermediate steps need not be.
Explanation:
Test case 1: We can move in the following manner: (1,1) > (2,1), using the operation (x,y) > (2*x,y). Then, move from (2,1) > (1,2), using the operation (x,y) > (y,x). Finally use the operation (x,y) > (2*x,y) to move from (1,2) > (2,2).
Author:  suh_ash2008 
Tags  suh_ash2008 
Date Added:  18022011 
Time Limit:  0.1 sec 
Source Limit:  50000 Bytes 
Languages:  C, CPP14, JAVA, PYTH, PYTH 3.6, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, SCALA, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, PERL6, TEXT, PYP3, CLOJ, FS 
Comments
 Please login at the top to post a comment.
SUCCESSFUL SUBMISSIONS
Fetching successful submissions
HELP
If you are still having problems, see a sample solution here. 