8665: Even Tree Split

内存限制:128 MB 时间限制:3 S 标准输入输出
题目类型:传统 评测方式:文本比较 上传者:
提交:1 通过:1

题目描述

You are given an undirected tree with n nodes. It's guaranteed that n is even.

You are going to delete some of the edges (at least 1), and have to let each of the remaining connected components have an even number of vertices.

Calculate the number of ways to delete the edges that satisfy such constraints, modulo 998244353

输入格式

The first line contains an integer T(1T30) - the number of test cases.

The first line of each test case contains an integer n(1n105) - the number of vertices on the tree.

The next n-1 lines of each test case contain two integers u,v(1u,vn), representing an edge between u and v.

It is guaranteed that the input graph is a tree with even number of vertices.

输出格式

For each test case, output the number of ways to delete the edges that satisfy such constraints in a single line, modulo 998244353

输入样例 复制

2
2
1 2
4
1 2
2 3
3 4

输出样例 复制

0
1