 Timer is Running

Check if possible to move from given coordinate to desired coordinate
##### Submissions: 265   Accuracy: 37.36%   Difficulty: Easy   Marks: 2

Given two coordinates (x, y) and (a, b). Find if it is possible to reach (x,y) from (a,b).

Only possible moves from any coordinate (i, j) are

• (i-j, j)
• (i, i-j)
• (i+j, j)
• (i, i+j)

Input:
The first line of input contains an integer T denoting the number of test cases. Then T test cases follow. The first line of each test case contains the integers x, y, a and b in that sequence.

Output:
Print 1 if it is possible to reach (a, b) from (x, y) under the above-mentioned constraints else print 0.

Constraints:
1 <= T <= 100
-1000 <= x, y, a, b <= 1000

Example:
Input:
2
1 1 2 3
35 15 20 25

Output:
1
1

Explanation:
Input:
(x, y) = (35, 15) and (a, b) = (20, 25).

Output: Yes.
(35, 15) -> (20, 15) -> (5, 15) -> (5, 10) -> (5, 5) ->(10, 5) -> (15, 5) -> (20, 5) -> (20, 25)

#### ** For More Input/Output Examples Use 'Expected Output' option **

Contributor: Sujnesh Mishra
Author: Dharmesh

If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.