QOJ.ac

QOJ

حد الوقت: 3 s حد الذاكرة: 256 MB مجموع النقاط: 100

#12036. Chordal Graph

الإحصائيات

Kelia is a girl who loves graph theory, and today she brings you an interesting graph theory problem.

To help improve your graph theory skills, Kelia first provides some simple definitions.

An undirected graph $G = \langle V, E \rangle$ is a chordal graph if and only if for any $k \geq 4$, there is no induced cycle of length $k$ in $G$. A $k$-cycle in $G$ is a sequence of nodes $a_1, \dots, a_k$ satisfying the following two conditions:

  1. All $a_i$ are distinct.
  2. There is an edge between $a_i$ and $a_j$ if and only if they are adjacent in the sequence, i.e., $i = j \pmod k + 1$ or $j = i \pmod k + 1$.

For an undirected graph $G = \langle V, E \rangle$, its line graph $L(G)$ is also an undirected graph:

  1. Its vertex set size is $|E|$, where the $i$-th vertex corresponds to the $i$-th edge in the original graph.
  2. There is an edge between two vertices in $L(G)$ if and only if the corresponding edges in the original graph share a common endpoint (note that there are no self-loops).

Both chordal graphs and line graphs are well-known definitions, and I believe you have solved many problems related to them. To make the problem more interesting, Kelia defines a "line-chordal graph": an undirected graph $G$ is a line-chordal graph if and only if $L(G)$ is a chordal graph.

To turn this into a counting problem, Kelia has made up a counting problem about line-chordal graphs:

Given a tree with $n$ nodes, you can add any number of undirected edges to it. How many ways are there to obtain a line-chordal graph without multiple edges or self-loops?

Two schemes are different if and only if there exists an edge $(i, j)$ that appears in exactly one of the schemes.

Input

The first line contains an integer $n$, representing the number of nodes in the tree.

The next $n-1$ lines each contain two integers $u, v$, representing an edge in the tree.

Output

Output a single integer representing the answer modulo $998244353$.

Examples

Input 1

3
1 2
1 3

Output 1

2

Input 2

4
1 2
1 3
1 4

Output 2

4

Input 3

6
1 2
1 3
2 4
2 5
2 6

Output 3

14

Subtasks

This problem is divided into 3 subtasks. You must pass all test cases in a subtask to receive the points for that subtask:

Subtask 1 (19 points): $n \leq 9$.

Subtask 2 (39 points): $n \leq 3000$.

Subtask 3 (42 points): $n \leq 2 \times 10^5$.

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.