{"trustable":false,"prependHtml":"\u003cstyle type\u003d\"text/css\"\u003e\n #problem-body \u003e pre {\n display: block;\n padding: 9.5px;\n margin: 0 0 10px;\n font-size: 13px;\n line-height: 1.42857143;\n word-break: break-all;\n word-wrap: break-word;\n color: #333;\n background: rgba(255, 255, 255, 0.5);\n border: 1px solid #ccc;\n border-radius: 6px;\n }\n\u003c/style\u003e\n","sections":[{"title":"","value":{"format":"HTML","content":"\u003cp\u003e \u0026nbsp;\u003c/p\u003e \n\u003cp\u003e \u003cspan\u003ePrasanth\u003c/span\u003e and \u003cspan\u003eKaushik\u003c/span\u003e\u0026nbsp;are good friends. They both had a quarrel recently while playing chess.\u0026nbsp;\u003cspan\u003eKaushik\u003c/span\u003e\u0026nbsp;wants to know the minimum number of moves a knight takes to reach from one square to another square of a chess board (\u003cspan\u003e8X8\u003c/span\u003e).\u0026nbsp;\u003cspan\u003eKaushik\u003c/span\u003e\u0026nbsp;is brilliant and he had already written a program to solve the problem.\u0026nbsp;\u003cspan\u003eKaushik\u003c/span\u003e\u0026nbsp;wants to know whether\u0026nbsp;\u003cspan\u003ePrasanth\u003c/span\u003e\u0026nbsp;can do it.\u0026nbsp;\u003cspan\u003ePrasanth\u003c/span\u003e\u0026nbsp;is very weak in programming. Help him to solve the problem.\u003c/p\u003e \n\u003cp\u003e \u0026nbsp;\u003c/p\u003e \n\u003cp\u003e A knight can move in the shape of an \"L\" in a chessboard - two squares either forward, backward, left, or right and then one square to its left or right. A knight move is valid if it moves as mentioned above and it is within the boundary of the chessboard (8 X 8).\u003c/p\u003e \n\u003cp\u003e \u0026nbsp;\u003c/p\u003e \n\u003cp\u003e \u003cimg alt\u003d\"http://0.tqn.com/d/chess/1/0/6/-/-/-/KnightMoves.gif\" src\u003d\"http://0.tqn.com/d/chess/1/0/6/-/-/-/KnightMoves.gif\"\u003e\u003c/p\u003e \n\u003cp\u003e \u0026nbsp;\u003c/p\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003ch3\u003e \u0026nbsp;\u003c/h3\u003e \n\u003cp\u003e There are T test cases in total. The next T lines contain two strings (start and destination) separated by a space.\u003c/p\u003e \n\u003cp\u003e The strings start and destination will only contain two characters - First character is an alphabet between \u0027a\u0027 and \u0027h\u0027 (inclusive), Second character is a digit between \u00271\u0027 and \u00278\u0027 (inclusive) - (Quotes just for clarity).\u003c/p\u003e \n\u003cp\u003e \u0026nbsp;\u003c/p\u003e \n\u003cp\u003e To know the knight moves more clearly refer to the above figure.\u003c/p\u003e \n\u003cp\u003e \u003cstrong\u003e\u003cspan\u003eConstarints\u003c/span\u003e\u003c/strong\u003e\u003c/p\u003e \n\u003cp\u003e \u003cspan\u003e1\u0026lt;\u003dT\u0026lt;\u003d4096\u003c/span\u003e\u003c/p\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003ch3\u003e \u0026nbsp;\u003c/h3\u003e \n\u003cp\u003e Print the minimum number of moves a knight takes to reach from start to destination in a separate line.\u003c/p\u003e"}},{"title":"Sample Input","value":{"format":"HTML","content":"\u003cp\u003e 3\u003c/p\u003e \n\u003cpre\u003e\r\n\u003cspan\u003ea1\u003c/span\u003e \u003cspan\u003eh8\u003c/span\u003e\r\n\u003cspan\u003ea1\u003c/span\u003e \u003cspan\u003ec2\u003c/span\u003e\r\n\u003cspan\u003eh8\u003c/span\u003e \u003cspan\u003ec3\u003c/span\u003e\u003c/pre\u003e"}},{"title":"Sample Output","value":{"format":"HTML","content":"\u003cp\u003e \u003cbr\u003e 6\u003cbr\u003e 1\u003cbr\u003e 4\u003c/p\u003e"}}]}