In chess, rooks are able to move in a horizontal direction or in a vertical one. In one move, they can get to any other location on the board until reaching an obstacle or the end of the board. If there is another figure on the path, the rook hits the figure.
Having two rooks, we would like to know if they hit each other. Given the
x1
and y1
coordinates of the first rook, and x2
and y2
coordinates of the second rook, print Yes
if they hit each other, and No
otherwise.Input | Output |
1
2
5
2 | Yes |
