{"trustable":true,"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":"\u003cdiv class\u003d\"panel_content\"\u003e As we all know, Matt is an outstanding contestant in ACM-ICPC. Graph problems are his favorite.\u003cbr\u003e\u003cbr\u003e Once, he came up with a simple algorithm for finding the maximal independent set in trees by mistake.\u003cbr\u003e\u003cbr\u003e A tree is a connected undirected graph without cycles, and an independent set is subset of the vertex set which contains no adjacent vertex pairs.\u003cbr\u003e\u003cbr\u003e Suppose that the tree contains N vertices, conveniently numbered by 1,2, . . . , N. First, Matt picks a permutation p\u003csub\u003e1\u003c/sub\u003e, p\u003csub\u003e2\u003c/sub\u003e, . . . , p\u003csub\u003eN\u003c/sub\u003e of {1, 2, 3, . . . , N } randomly and uniformly.\u003cbr\u003e\u003cbr\u003e After picking the permutation, Matt does the following procedure.\u003cbr\u003e\u003cbr\u003e 1.Set S \u003d \u003cimg style\u003d\"max-width:100%;\" src\u003d\"CDN_BASE_URL/68ad011154eda8d33baebe99940851c4?v\u003d1726223341\"\u003e.\u003cbr\u003e 2.Consider the vertex p\u003csub\u003e1\u003c/sub\u003e, p\u003csub\u003e2\u003c/sub\u003e, . . . , p\u003csub\u003eN\u003c/sub\u003e accordingly. For vertex p\u003csub\u003ei\u003c/sub\u003e, if and only if there is no vertex in S which is adjacent to p\u003csub\u003ei\u003c/sub\u003e, add vertex p\u003csub\u003ei\u003c/sub\u003e into S.\u003cbr\u003e 3.Output the set S.\u003cbr\u003e\u003cbr\u003e Clearly the above algorithm does not always output the maximal independent set. Matt would like to know the expected size of set S instead.\u003c/div\u003e"}},{"title":"Input","value":{"format":"HTML","content":" The first line contains only one integer T , which indicates the number of test cases.\u003cbr\u003e\u003cbr\u003e For each test case, the first line contains an integer N (1 ≤ N ≤ 200), indicating the number of vertices in the graph.\u003cbr\u003e\u003cbr\u003e Each of the following N - 1 lines contains two integers u, v (1 ≤ u, v ≤ N ) indicating an edge between u and v. You may assume that all the vertices are connected."}},{"title":"Output","value":{"format":"HTML","content":" For each test case, output a single line “Case #x: y”, where x is the case number (starting from 1) and y is the answer. To avoid rounding error, the answer you should output is:\u003cbr\u003e\u003cbr\u003e\u003ccenter\u003e(the expected size of independent set) × N! mod (10\u003csup\u003e9\u003c/sup\u003e + 7)\u003c/center\u003e"}},{"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\u003e2\r\n4\r\n1 2\r\n1 3\r\n1 4\r\n3\r\n1 2\r\n2 3\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003eCase #1: 60\r\nCase #2: 10\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}},{"title":"Hint","value":{"format":"HTML","content":"In the \u0026amp;#64257;rst sample, there are 4 vertices, so there are 4! permutations Matt may get.\u003cbr\u003eSuppose the permutation Matt gets is 1 2 3 4. He will add vertex 1 into the independent set.\u003cbr\u003eSuppose the permutation Matt gets is 2 1 3 4. He will add vertex 2, vertex 3 and vertex 4 into the independent set.\u003cbr\u003eIt is obvious that if the \u0026amp;#64257;rst element in the permutation is not vertex 1, he will get an independent set whose size is 3. Otherwise, he well get an independent set whose size is 1. Since there are 18\u003cbr\u003epermutations whose \u0026amp;#64257;rst element is not vertex 1, the answer in the \u0026amp;#64257;rst sample is (3 × 18 + 1 × 6) mod (10^9 + 7) \u003d 60.\u003cbr\u003e"}}]}