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)

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.

saiujwal13083 | 347 |

isiddhisingh | 252 |

Abhishek_Jadhav | 243 |

_uncle_sam_ | 221 |

c_ocoooo | 217 |

saiujwal13083 | 610 |

SumitSingh27 | 466 |

c_ocoooo | 456 |

rathiarpit29 | 379 |

NaveenKumarNakka | 370 |

blackshadows | 5362 |

Ibrahim Nash | 5242 |

akhayrutdinov | 5111 |

mb1973 | 4931 |

Quandray | 4598 |

Login to report an issue on this page.