Coloring the Paths at ADA University#11867

Coloring the Paths at ADA University

2 seconds
128 megabytes
Medium

On the territory of ADA University in Baku, pedestrian paths connect various campuses and buildings. These paths form a tree with nodes, rooted at node (Building A).

You need to color each node of the tree with one of two colors: red or blue.

A coloring of the tree is considered good if, for every subtree, the absolute difference between the number of red and blue nodes does not exceed .

Find the total number of good colorings for the given tree. Since the number of such colorings can be very large, output it modulo 10^9 + 7.

Input

The first line contains a single integer t~(t \le 10^4) — the number of test cases. Each test case consists of several lines:

The first line contains a single integer n~(2 \le n \le 10^5) — the number of nodes in the tree.

The following n - 1 lines each contain two integers u_i and v_i~(1 \le u_i, v_i \le n) — representing an edge between vertices u_i and v_i.

Output

For each test case, print a single integer — the number of good colorings of the given tree modulo 10^9 + 7.

Examples

Example 1

Loading
Loading