{"trustable":true,"sections":[{"title":"","value":{"format":"HTML","content":"Professor B. Heif is conducting experiments with a species of South American bees that he found during an expedition to the Brazilian rain forest. The honey produced by these bees is of superior quality compared to the honey from European and North American honey bees. Unfortunately, the bees do not breed well in captivity. Professor Heif thinks the reason is that the placement of the different maggots (for workers, queens, etc.) within the honeycomb depends on environmental conditions, which are different in his laboratory and the rain forest. \r\u003cbr\u003eAs a first step to validate his theory, Professor Heif wants to quantify the difference in maggot placement. For this he measures the distance between the cells of the comb into which the maggots are placed. To this end, the professor has labeled the cells by marking an arbitrary cell as number 1, and then labeling the remaining cells in a clockwise fashion, as shown in the following figure. \r\u003cbr\u003e\u003ccenter\u003e\u003ctable\u003e\u003ctbody\u003e\u003ctr\u003e\u003ctd\u003e\u003cpre\u003e\r\u003cbr\u003e __ __ __ __\r\u003cbr\u003e __/ \\__/ \\__/ \\__/ \\__\r\u003cbr\u003e __/ \\__/ \\__/53\\__/ \\__/ \\__\r\u003cbr\u003e/ \\__/ \\__/52\\__/54\\__/ \\__/ \\\r\u003cbr\u003e\\__/ \\__/51\\__/31\\__/55\\__/ \\__/\r\u003cbr\u003e/ \\__/50\\__/30\\__/32\\__/56\\__/ \\\r\u003cbr\u003e\\__/49\\__/29\\__/15\\__/33\\__/57\\__/\r\u003cbr\u003e/ \\__/28\\__/14\\__/16\\__/34\\__/ \\\r\u003cbr\u003e\\__/48\\__/13\\__/ 5\\__/17\\__/58\\__/\r\u003cbr\u003e/..\\__/27\\__/ 4\\__/ 6\\__/35\\__/ \\\r\u003cbr\u003e\\__/47\\__/12\\__/ 1\\__/18\\__/59\\__/\r\u003cbr\u003e/..\\__/26\\__/ 3\\__/ 7\\__/36\\__/ \\\r\u003cbr\u003e\\__/46\\__/11\\__/ 2\\__/19\\__/60\\__/\r\u003cbr\u003e/..\\__/25\\__/10\\__/ 8\\__/37\\__/ \\\r\u003cbr\u003e\\__/45\\__/24\\__/ 9\\__/20\\__/61\\__/\r\u003cbr\u003e/..\\__/44\\__/23\\__/21\\__/38\\__/ \\\r\u003cbr\u003e\\__/70\\__/43\\__/22\\__/39\\__/62\\__/\r\u003cbr\u003e/ \\__/69\\__/42\\__/40\\__/63\\__/ \\\r\u003cbr\u003e\\__/ \\__/68\\__/41\\__/64\\__/ \\__/\r\u003cbr\u003e/ \\__/ \\__/67\\__/65\\__/ \\__/ \\\r\u003cbr\u003e\\__/ \\__/ \\__/66\\__/ \\__/ \\__/\r\u003cbr\u003e \\__/ \\__/ \\__/ \\__/ \\__/\r\u003cbr\u003e \\__/ \\__/ \\__/ \\__/\u003c/pre\u003e\u003c/td\u003e\u003c/tr\u003e\u003c/tbody\u003e\u003c/table\u003e\u003c/center\u003e\r\u003cbr\u003eFor example, two maggots in cells 19 and 30 are 5 cells apart. One of the shortest paths connecting the two cells is via the cells 19 - 7 - 6 - 5 - 15 - 30, so you must move five times to adjacent cells to get from 19 to 30. \r\u003cbr\u003eProfessor Heif needs your help to write a program that computes the distance, defined as the number of cells in a shortest path, between any pair of cells. \r\u003cbr\u003e"}},{"title":"Input","value":{"format":"HTML","content":"The input consists of several lines, each containing two integers a and b (a,b \u0026lt;\u003d 10000), denoting numbers of cells. The integers are always positive, except in the last line where a\u003db\u003d0 holds. This last line terminates the input and should not be processed. "}},{"title":"Output","value":{"format":"HTML","content":"For each pair of numbers (a,b) in the input file, output the distance between the cells labeled a and b. The distance is the minimum number of moves to get from a to b. "}},{"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\u003e19 30\r\n0 0\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003eThe distance between cells 19 and 30 is 5.\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}