{"trustable":false,"prependHtml":"\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 async src\u003d\"https://mathjax.codeforces.org/MathJax.js?config\u003dTeX-AMS-MML_HTMLorMML\" type\u003d\"text/javascript\"\u003e\u003c/script\u003e","sections":[{"title":"","value":{"format":"HTML","content":"寻找图中从一条边到另一条边的路径上必须经过的点的个数。\n可能有重边。\n\u003cscript type\u003d\u0027text/x-mathjax-config\u0027\u003eMathJax.Hub.Config({tex2jax: { inlineMath: [[\u0027$\u0027,\u0027$\u0027]] } }); \u003c/script\u003e\n\u003cscript type\u003d\u0027text/javascript\u0027 src\u003d\u0027https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config\u003dTeX-AMS-MML_HTMLorMML\u0027\u003e\u003c/script\u003e\n\u003cscript type\u003d\u0027text/javascript\u0027\u003esetTimeout(function(){MathJax.Hub.Queue([\u0027Typeset\u0027, MathJax.Hub, \u0027left_view\u0027]);}, 2000);\u003c/script\u003e\n\u003cdiv class\u003d\"panel_content\"\u003e\n City C is really a nightmare of all drivers for its traffic jams. To solve the traffic problem, the mayor plans to build a RTQS (Real Time Query System) to monitor all traffic situations. City C is made up of N crossings and M roads, and each road connects two crossings. All roads are bidirectional. One of the important tasks of RTQS is to answer some queries about route-choice problem. Specifically, the task is to find the crossings which a driver MUST pass when he is driving from one given road to another given road. \n\u003c/div\u003e"}},{"title":"Input","value":{"format":"HTML","content":"There are multiple test cases. \n\u003cbr\u003eFor each test case: \n\u003cbr\u003eThe first line contains two integers N and M, representing the number of the crossings and roads. \n\u003cbr\u003eThe next M lines describe the roads. In those M lines, the i \n\u003csup\u003eth\u003c/sup\u003e line (i starts from 1)contains two integers X \n\u003csub\u003ei\u003c/sub\u003e and Y \n\u003csub\u003ei\u003c/sub\u003e, representing that road \n\u003csub\u003ei\u003c/sub\u003e connects crossing X \n\u003csub\u003ei\u003c/sub\u003e and Y \n\u003csub\u003ei\u003c/sub\u003e (X \n\u003csub\u003ei\u003c/sub\u003e≠Y \n\u003csub\u003ei\u003c/sub\u003e). \n\u003cbr\u003eThe following line contains a single integer Q, representing the number of RTQs. \n\u003cbr\u003eThen Q lines follows, each describing a RTQ by two integers S and T(S≠T) meaning that a driver is now driving on the roads and he wants to reach roadt . It will be always at least one way from roads to roadt. \n\u003cbr\u003eThe input ends with a line of “0 0”. \n\u003cbr\u003ePlease note that: 0\u0026lt;N\u0026lt;\u003d10000, 0\u0026lt;M\u0026lt;\u003d100000, 0\u0026lt;Q\u0026lt;\u003d10000, 0\u0026lt;X \n\u003csub\u003ei\u003c/sub\u003e,Y \n\u003csub\u003ei\u003c/sub\u003e\u0026lt;\u003dN, 0\u0026lt;S,T\u0026lt;\u003dM \n\u003cbr\u003e"}},{"title":"Output","value":{"format":"HTML","content":"For each RTQ prints a line containing a single integer representing the number of crossings which the driver MUST pass."}},{"title":"Sample Input","value":{"format":"HTML","content":"\u003cpre\u003e5 6\n1 2\n1 3\n2 3\n3 4\n4 5\n3 5\n2\n2 3\n2 4\n0 0\u003c/pre\u003e"}},{"title":"Sample Output","value":{"format":"HTML","content":"\u003cpre\u003e0\n1\u003c/pre\u003e"}}]}