SP8419 BTCODE_A - Traversing Grid

Description

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 Format

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 Format

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)