# Practice on Toph

Participate in exhilarating programming contests, solve unique algorithm and data structure challenges and be a part of an awesome community.

# Alice and the Chessboard

It’s Sunday afternoon, and Alice is in her room trying to figure out the rules of the game called Chess. She thinks she’s almost got it, but she’d like your help.

Alice has placed a bishop on an empty chessboard. Given the position of the bishop and the positon of another square on the chessboard, Alice would like to know if the bishop can travel to that square in one move or not.

Chess is a game played on an **8*8** rectangular board. The rows of the board are numbered from 1…8 and similarly the columns are numbered from 1…8. (For this problem, you may assume that the rows are numbered from 1 to 8 from top to bottom and the columns are numbered from 1 to 8 from left to right). The bishop occupies a single square on the board (as does every other piece) and it can move any number of squares diagonally, but it cannot travel outside the board. Below is a picture demonstrating the moves of a bishop. The dotted squares are the squares the bishop can travel to in one move.

## Input

In the first line of input, there is a number **T** (1 ≤ T ≤ 200) denoting the number of test cases. Each of the next **T** lines contains the description of the **T** testcases. Each testcase contains four integers in a single line. The first two integer denotes the row and the column of the position of the bishop respectively and the second two integers denotes the row and the column of the postion of the targeted square respectively. It is guaranteed that the two squares won’t be the same. And of course, each of these integers will be between 1 and 8.

## Output

For each test case, print “Yes” (without the quote) in a single line if the bishop can travel to the targeted square in one move. Otherwise print “No” (without the quote) in a single line.

## Sample

Input | Output |
---|---|

3 5 6 5 1 1 1 2 3 3 4 5 2 | No No Yes |

88% Solution Ratio

rezaulhsagarEarliest,

rezaulhsagarFastest, 0.0s

Raiyan13Lightest, 0 B

touhidurShortest, 98B

Login to submit