P23420 [AtCoder] Tree Vertices XOR
NOI
题目描述

Problem Statement

You are given a tree with N vertices.
The vertices are numbered from 1 to N, and the i-th edge connects vertices u_i and v_i.
Initially, on each vertex of the tree is written number 1.
In one operation, you can do the following:

  • Choose any vertex v of the tree. Let X be the XOR of the values written in the neighbors of v. Then, if the number written on v is a_v, replace it by (a_v\ $\mathrm{XOR}$\ X).

You can perform this operation any finite (maybe zero) number of times. How many configurations can you achieve? As this number can be large, output it modulo 998244353.
Two configurations are called different if there exists a vertex v, such that the numbers written in v in these configurations are different.

Input

Input is given from Standard Input in the following format:
N
u_1 v_1
u_2 v_2
$\vdots$
u_{N-1} v_{N-1}

Output

Output the number of configurations you can get from the initial state, modulo 998244353.

Constraints

  • $3 \le N \le 2\cdot 10^5$
  • $1\le u_i, v_i \le N$
  • $u_i \neq v_i$
  • The input represents a valid tree.

Sample Input 1

4
1 2
2 3
3 4

Sample Output 1

10

We can get the following configurations (abcd means vertices 1,2,3,4 have a,b,c,d written on them):
1111, 1110, 1100, 1000, 0111, 0110, 0100, 0011, 0010, 0001.

Sample Input 2

5
1 2
1 3
1 4
1 5

Sample Output 2

24

Sample Input 3

6
1 3
2 3
3 4
4 5
4 6

Sample Output 3

40

Sample Input 4

9
1 2
2 3
1 4
4 5
1 6
6 7
7 8
8 9

Sample Output 4

255

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
4 1 2 2 3 3 4
样例输出
10