# Practice on Toph

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

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

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.

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.

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.

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

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

92% Solution Ratio

Mr.adnanEarliest,

rayhan50001Fastest, 0.0s

Raiyan13Lightest, 0 B

touhidurShortest, 98B

Login to submit

If the absolute difference between the row of the current cell and the target cell is equal to the a...