#Lutece3224. 删删乐
删删乐
Migrated from Lutece 3224 删删乐
All parts of this problem, including description, images, samples, data and checker, might be broken. If you find bugs in this problem, please contact the admins.
Description
给定一棵 个点的树。
现执行以下操作 次:
- 任选一个未被删除的点 ,令 等于与 相连且未被删除的边的条数。
- 将点 及与 相连的所有边删除。
对于每个 , 求最终能得到多少个不同的序列 ,满足 。答案对 取模。
对任意自然数 ,规定
Input
第一行,一个正整数 ,表示数据组数。
对于每组测试数据,第一行,一个正整数 。
接下来 行,每行两个正整数,描述一条边 。
Output
对于每组测试数据,输出一行, 个正整数,用空格间隔,第 个数表示当 时的答案。
Samples
1
3
1 2
1 3
3 1 0
Constraints
Resources
2024 UESTC ICPC Training for Math