Dear students! During the summer holidays, Bento found a piece of a sawed-off chessboard and began teaching his friend Quilby how to play chess. Quilby quickly mastered the knight's moves and, with strong mathematical skills, keeps asking: "How many closed knight's tours are possible starting from this square, ensuring it returns to the starting point and visits each other square no more than once?" Bento managed to solve this puzzle for one example, but Quilby is relentless. Please write a program that can determine this number for any square on this unusual chessboard. With your help, quick answers can be provided. Thank you in advance.
Each test consists of several test cases. Each line indicates a new starting position for the knight on the board. The number of test cases in a single test does not exceed .
The board always has columns and rows, with columns labeled by Latin letters from to , and rows numbered from to .
For each test case, output the number of closed knight's tours on a separate line.
Example 1