P2520 [HAOI2011] Vectors

Description

Given a pair of numbers $(a,b)$, you may use any of the vectors $(a,b)$, $(a,-b)$, $(-a,b)$, $(-a,-b)$, $(b,a)$, $(b,-a)$, $(-b,a)$, $(-b,-a)$ in arbitrary quantities. Determine whether you can form another vector $(x,y)$. Note: Here, “form” means that the sum of the vectors you choose equals $(x,y)$.

Input Format

The first line contains the number of test cases $t$ ($t \le 50000$). The next $t$ lines each contain four integers $a, b, x, y$ ($-2\times 10^9 \le a, b, x, y \le 2\times 10^9$).

Output Format

Output $t$ lines. Each line is `Y` if it is possible, or `N` if it is not.

Explanation/Hint

### Sample Explanation Group 1: $(2,1) + (1,2) = (3,3)$. Group 3: $(-1,0) + (-1,0) + (0,1) + (0,1) + (0,1) = (-2,3)$. Translated by ChatGPT 5