
Your friend Vasyl is developing a computer game called "Mythical Chess", but he cannot finish the project on time.
Vasyl asked his friends for help. He needs a module that calculates the optimal way to move a piece from one square to another. Because Vasyl has many friends, each received a small subtask. Your task is to write a program that determines the minimum number of moves required for a centaur to move from one square to another.
Mythical chess is played on a 9 \times 9 chessboard, with the corner squares painted black. The centaur is a mythical chess piece that combines the characteristics of a knight and a bishop. When the centaur stands on a white square, it moves only as a knight; when on a black square, it moves only as a bishop. The illustrations show options for the moves of two centaurs (the letter "K" marks the centaur's position, and stars mark possible moves).
The first line contains a natural number — the number of tests. Each of the next lines contains the coordinates (uppercase Latin letter and digit) of two squares of the mythical chessboard, separated by a space.
For each test, output a line containing the minimum number of moves the centaur needs to move from the first square to the second. If it is not possible, output -1 (without quotes).
Example 1