Disjoint Path On Tree
时间限制:C/C++/Rust/Pascal 1秒,其他语言2秒
空间限制:C/C++/Rust/Pascal 256 M,其他语言512 M
64bit IO Format: %lld

题目描述

You are given a tree consisting of n vertices. Recall that a tree is an undirected connected acyclic graph.
Now, calculate the number of simple path pairs that each pair of simple paths does not pass through the same vertex. Note that pair(Path_i,Path_j) and pair(Path_j,Path_i) should only be calculated once. As the answer may be too big, output the answer module .
The simple path is the path that visits each vertex at most once. The path only visits a single vertex is also a path.

输入描述:

The first line contains a single integer  --- the number of test cases.
The first line of each test case contains a single integer --- the number of vertices.
The next n-1 lines of each test case describe the edges of the tree in form of . It is guaranteed that given graph is a tree.
It is guaranteed that over all test cases.

输出描述:

For each test case, output a single integer in a line --- the answer module .
示例1

输入

复制
1
3
1 2
1 3

输出

复制
5

说明

5 pairs of paths in the sample are:
(1,2)
(1,3)
(2,3)
(1-2,3)
(1-3,2)