You are given a 6 \times 6 chessboard with three pieces: a white king, a white rook, and a black king. Your task is to determine the minimum number of moves required for white to checkmate the black king, or to establish if checkmate is impossible or if the position is invalid.
The input consists of a single line containing the coordinates of the white king, the white rook, and the black king, respectively. After the coordinates, there is a space and then a character indicating which side makes the first move ( for white or for black).
Output the total number of moves made by both sides required for white to win the game. If the black king is already checkmated, output . If the input position is invalid, output . If the game ends in a draw (for example, if there is stalemate), output .
Example 1