{"trustable":true,"sections":[{"title":"","value":{"format":"HTML","content":"\u003cb\u003eBackground\u003c/b\u003e\r\u003cbr\u003eMr Somurolov, fabulous chess-gamer indeed, asserts that no one else but him can move knights from one position to another so fast. Can you beat him?\r\u003cbr\u003e\u003cb\u003eThe Problem\u003c/b\u003e\r\u003cbr\u003eYour task is to write a program to calculate the minimum number of moves needed for a knight to reach one point from another, so that you have the chance to be faster than Somurolov.\r\u003cbr\u003eFor people not familiar with chess, the possible knight moves are shown in Figure 1.\r\u003cbr\u003e\u003ccenter\u003e\u003cimg src\u003d\"CDN_BASE_URL/d2b26809455ce72d961db3fab309bf1a?v\u003d1726541251\"\u003e\u003c/center\u003e\r\u003cbr\u003e"}},{"title":"Input","value":{"format":"HTML","content":"The input begins with the number n of scenarios on a single line by itself.\r\u003cbr\u003eNext follow n scenarios. Each scenario consists of three lines containing integer numbers. The first line specifies the length l of a side of the chess board (4 \u0026lt;\u003d l \u0026lt;\u003d 300). The entire board has size l * l. The second and third line contain pair of integers {0, ..., l-1}*{0, ..., l-1} specifying the starting and ending position of the knight on the board. The integers are separated by a single blank. You can assume that the positions are valid positions on the chess board of that scenario."}},{"title":"Output","value":{"format":"HTML","content":"For each scenario of the input you have to calculate the minimal amount of knight moves which are necessary to move from the starting point to the ending point. If starting point and ending point are equal,distance is zero. The distance must be written on a single line."}},{"title":"Sample","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e3\r\n8\r\n0 0\r\n7 0\r\n100\r\n0 0\r\n30 50\r\n10\r\n1 1\r\n1 1\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e5\r\n28\r\n0\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}