P16492 [CodeChef] KNIGHTATTACK
普及
题目描述

While playing chess, Chef noticed that it is generally advantageous for him if his knight attacks two or more of his opponent's pieces simultaneously. To practice this skill, Chef decided to perform the following exercise:

Take an empty $8 \times 8$ chessboard, and any two white pieces.
Choose two distinct cells (X_{1}, Y_{1}), (X_{2}, Y_{2}) and place the pieces on those cells (the cell at the intersection of the i-th row and j-th column is denoted (i, j)).
Check if there exists an empty cell where he can place a black knight in such a way that the knight attacks both the white pieces simultaneously.

Given the position of the two white pieces (X_{1}, Y_{1}), (X_{2}, Y_{2}), print 'YES' if there exists an empty cell where he can place a black knight in such a way that the knight attacks both the white pieces simultaneously, otherwise print NO.

For reference, a knight attacks a piece placed in a cell that is:
One square horizontally and two squares vertically away from it, or
One square vertically and two squares horizontally away from it

A visual description of this may be found [here]#Movement).

------ Input Format ------

  • The first line of input will contain an integer T — the number of test cases. The description of T test cases follows.
  • The first line of each test case contains two space-separated integers X_{1} and Y_{1}, the position of first white piece.
  • The second line of each test case contains two space-separated integers X_{2} and Y_{2}, the position of second white piece.

------ Output Format ------

For each test case, output the answer on a new line — YES if there exists an empty cell where Chef can place a black knight in such a way that the knight attacks both the white pieces simultaneously, and NO otherwise.

You may print each character of YES and NO in either uppercase or lowercase (for example, yes, yEs, Yes will be considered identical).

------ Constraints ------

$1 ≤ T ≤ 5000$
$1 ≤ X_{1}, Y_{1} ≤ 8$
$1 ≤ X_{2}, Y_{2} ≤ 8$
- Both the cells are distinct

----- Sample Input 1 ------
4
1 1
1 2
1 1
1 3
1 1
1 4
1 1
1 5
----- Sample Output 1 ------
NO
YES
NO
YES

----- explanation 1 ------
Test case $2$: Chef can place a knight at $(3, 2)$, forking both pieces.

Test case $4$: Chef can place a knight at $(2, 3)$, forking both pieces.

In the other two cases it can be verified that there is no way to place a knight that attacks both pieces at the same time.

输入格式

见题面

输出格式

见题面

样例输入
4 1 1 1 2 1 1 1 3 1 1 1 4 1 1 1 5
样例输出
NO YES NO YES