Module: (Java) Workshop-2 "Chess and chess players". Conditional operator


Problem

8 /13


King move

Problem

King – this is a special piece in chess. Its value is incomparable with the value of other pieces – with his loss, the game ends immediately.

That Chess King is priceless! But he also has the right to fight. The king can close the path to three pawns. And when paired with a pawn, he can cause trouble for the strongest pieces. The chess king moves horizontally, vertically and diagonally, but only 1 square.
Let's help Willie program the move of the chess king. 

Given two different cells of a chessboard, determine if the king can get from the first cell to the second in one move.

Input 
The program receives as input four numbers from 1 to 8 each, specifying the column number and row number, first for the first cell, then for the second cell. Each number is given on a separate line.

Imprint 
The program should output YES if it is possible to get from the first cell to the second by the king's move, or NO  otherwise.
 

 

Examples
# Input Output
1 4
4
5
5
YES