Checkmate in One
Chess has been a long time passion of Yraglac. He spents at least an hour per day playing chess matches online or reading chess tactics books. The game is played by two players on an $8 \times 8$ grid, with each player taking turns to move a piece.
In this problem, we will consider a simplified variant of chess consisting of two kinds of pieces: kings and rooks. Kings can move one square in any direction while rooks can move any number of squares up/down or left/right. Pieces can either move to an unoccupied square or to a square occupied by an opponent’s piece, which is captured and removed from play. A piece is threatened when an opponent’s piece is able to capture the piece in a single move. It is illegal to move one own’s king to a position where it is threatened (but it is legal to do so for a rook).
A player is considered to be in checkmate when it is their turn, their king is threatened, and all possible moves will result in the king still being threatened.
Yraglac is a skilled player and has managed to reach a situation where he has one king and one rook, while his opponent only has one king. Given that it is Yraglac’s turn, can he checkmate his opponent in a single move?
The input consists of a single test case representing a chessboard. It will consist of eight lines with eight characters each, where “R” represents Yraglac’s rook, “K” represents Yraglac’s king, “k” represents the opponent’s king, and “.” represents an empty square. It is guaranteed that Yraglac will have exactly one king and one rook, while his opponent will only have one king. It is also guaranteed that no king will be threatened.
Output “Yes” if Yraglac can checkmate his opponent in a single move, or “No” otherwise.
Explanation of Sample Input
In the first sample, Yraglac can checkmate his opponent by moving his rook to the bottom right square. In the second sample, there is no single move that will checkmate his opponent.
|Sample Input 1||Sample Output 1|
........ ........ ........ ........ .....K.k ........ ........ R.......
|Sample Input 2||Sample Output 2|
........ ........ ........ ........ ....K..k ........ ........ R.......