{"trustable":false,"prependHtml":"\u003cstyle type\u003d\u0027text/css\u0027\u003e\n .input, .output {\n border: 1px solid #888888;\n }\n .output {\n margin-bottom: 1em;\n position: relative;\n top: -1px;\n }\n .output pre, .input pre {\n background-color: #EFEFEF;\n line-height: 1.25em;\n margin: 0;\n padding: 0.25em;\n }\n \u003c/style\u003e\n \u003clink rel\u003d\"stylesheet\" href\u003d\"//codeforces.org/s/96598/css/problem-statement.css\" type\u003d\"text/css\" /\u003e\u003cscript\u003e window.katexOptions \u003d { disable: true }; \u003c/script\u003e\n\u003cscript type\u003d\"text/x-mathjax-config\"\u003e\n MathJax.Hub.Config({\n tex2jax: {\n inlineMath: [[\u0027$$$\u0027,\u0027$$$\u0027], [\u0027$\u0027,\u0027$\u0027]],\n displayMath: [[\u0027$$$$$$\u0027,\u0027$$$$$$\u0027], [\u0027$$\u0027,\u0027$$\u0027]]\n }\n });\n\u003c/script\u003e\n\u003cscript type\u003d\"text/javascript\" async src\u003d\"https://mathjax.codeforces.org/MathJax.js?config\u003dTeX-AMS_HTML-full\"\u003e\u003c/script\u003e","sections":[{"title":"","value":{"format":"HTML","content":"\u003cp\u003e\nAman and Pujan are very good friends. They are preparing a programming contest together at the university. There are \u003cb\u003en\u003c/b\u003e classrooms in this university, and these \u003cb\u003en\u003c/b\u003e classrooms are connected with each other by \u003cb\u003en-1\u003c/b\u003e corridors, so students can walk from each classroom to any other classroom through the corridor.\nYou can think of classrooms as vertices and corridors as edges of the tree.\n\u003cp\u003e\nEvery day, Aman and Pujan are preparing questions in their own room (their rooms are different). They decide to meet in the same classroom in the evening for discussion. They hope that the classroom they are discussing is at the same distance from their respective rooms. The distance between any two classrooms refers to the shortest distance in the tree. \n\u003c/p\u003e\n\u003cp\u003e\nThey prepare questions for the next \u003cb\u003em\u003c/b\u003e days. Each day Aman is in room \u003cb\u003ex\u003csub\u003ej\u003c/sub\u003e\u003c/b\u003e and Pujan is in room \u003cb\u003ey\u003csub\u003ej\u003c/sub \u003e\u003c/b\u003e. They hope you can help them figure out how many classrooms are at the same distance from their respective locations for the next \u003cb\u003em\u003c/b\u003e days.\n\n\u003c/p\u003e\n\n"}},{"title":"Input","value":{"format":"HTML","content":"\u003cp\u003e\nFirst line contains the number of rooms \u003cb\u003en (1\u0026le;n\u0026le;10\u003csup\u003e5\u003c/sup\u003e)\u003c/b\u003e. The next \u003cb\u003en-1\u003c/b\u003e lines contain a pair of integers \u003cb\u003el\u003csub\u003ei\u003c/sub\u003e, r\u003csub\u003ei\u003c/sub\u003e\u003c/b\u003e denoting that corridor \u003cb\u003ei\u003c/b\u003e connects these two rooms. The next line contains an integer \u003cb\u003em (1\u0026le;m\u0026le;10\u003csup\u003e5\u003c/sup\u003e)\u003c/b\u003e denoting the number of days. Now \u003cb\u003em\u003c/b\u003e lines follow. Each line contains a pair of integers \u003cb\u003ex\u003csub\u003ej\u003c/sub\u003e\u003c/b\u003e and \u003cb\u003ey\u003csub\u003ej\u003c/sub\u003e\u003c/b\u003e denoting the rooms where Aman and Pujan started preparing questions on the \u003cb\u003ej\u003csup\u003eth\u003c/sup\u003e\u003c/b\u003e day.\n\u003c/p\u003e\n\n"}},{"title":"Output","value":{"format":"HTML","content":"\u003cp\u003ePrint the answer for each of the \u003cb\u003em\u003c/b\u003e days.\u003c/p\u003e"}},{"title":"Examples","value":{"format":"HTML","content":"\u003cdiv class\u003d\"sample-test\"\u003e\n \u003cdiv class\u003d\"input\"\u003e\n \u003cdiv class\u003d\"title\"\u003e\n Input\n \u003c/div\u003e\n \u003cpre\u003e4\u003cbr\u003e1 2\u003cbr\u003e1 3\u003cbr\u003e2 4\u003cbr\u003e1\u003cbr\u003e2 3\u003cbr\u003e\u003c/pre\u003e\n \u003c/div\u003e\n \u003cdiv class\u003d\"output\"\u003e\n \u003cdiv class\u003d\"title\"\u003e\n Output\n \u003c/div\u003e\n \u003cpre\u003e1\u003cbr\u003e\u003c/pre\u003e\n \u003c/div\u003e\n \u003cdiv class\u003d\"input\"\u003e\n \u003cdiv class\u003d\"title\"\u003e\n Input\n \u003c/div\u003e\n \u003cpre\u003e4\u003cbr\u003e1 2\u003cbr\u003e2 3\u003cbr\u003e2 4\u003cbr\u003e2\u003cbr\u003e1 2\u003cbr\u003e1 3\u003cbr\u003e\u003c/pre\u003e\n \u003c/div\u003e\n \u003cdiv class\u003d\"output\"\u003e\n \u003cdiv class\u003d\"title\"\u003e\n Output\n \u003c/div\u003e\n \u003cpre\u003e0\u003cbr\u003e2\u003cbr\u003e\u003c/pre\u003e\n \u003c/div\u003e\n\u003c/div\u003e"}},{"title":"Note","value":{"format":"HTML","content":"\u003cp\u003eIn the sample test case 1, only the room number 1 is equidistant from rooms 2 and 3.\u003c/p\u003e"}}]}