Problem G. One-move checkmate

Author:Far-Eastern Subregional   Time limit:1 sec
Input file:input.txt   Memory limit:8 Mb
Output file:output.txt  

Statement

The chess endgame "a king and a queen versus a king" is known to be easy victory for the side that has a queen. The position in such an endgame is described by the locations of three figures: the white king, the white queen, and the black king. Locations are written in a usual chess notation, constructed from a letter from "a" to "h", which determine vertical line, and the digit from 1 to 8, which determine horizontal line of the location. Given the position described, you are find a move for the white queen by which the black king will be checkmated, or determine that no such a move exists.

Input file format

The input file contains three two-character locations for the white king, white queen, and black king, in that order, separated by spaces. The input position is a valid chess position for the white's turn, i.e. all figures occupy different spaces, kings are not located in the neighboring squares, and the black king is not under the check.

Output file format

Output file must contain the two-character location - destination square for the white queen's move. If checkmating move does not exist, output file must contain the string "no". If there is more than one checkmating move, you may output any one of them.

Sample tests

No. Input file (input.txt) Output file (output.txt)
1
a3 g2 a1
a2

0.080s 0.026s 13