#P1725I. Imitating the Key Tree

Imitating the Key Tree

Description

Pak Chanek has a tree called the key tree. This tree consists of NN vertices and N1N-1 edges. The edges of the tree are numbered from 11 to N1N-1 with edge ii connecting vertices UiU_i and ViV_i. Initially, each edge of the key tree does not have a weight.

Formally, a path with length kk in a graph is a sequence [v1,e1,v2,e2,v3,e3,,vk,ek,vk+1][v_1, e_1, v_2, e_2, v_3, e_3, \ldots, v_k, e_k, v_{k+1}] such that:

  • For each ii, viv_i is a vertex and eie_i is an edge.
  • For each ii, eie_i connects vertices viv_i and vi+1v_{i+1}.

A circuit is a path that starts and ends on the same vertex.

A path in a graph is said to be simple if and only if the path does not use the same edge more than once. Note that a simple path can use the same vertex more than once.

The cost of a simple path in a weighted graph is defined as the maximum weight of all edges it traverses.

Count the number of distinct undirected weighted graphs that satisfy the following conditions:

  • The graph has NN vertices and 2N22N-2 edges.
  • For each pair of different vertices (x,y)(x, y), there exists a simple circuit that goes through vertices xx and yy in the graph.
  • The weight of each edge in the graph is an integer between 11 and 2N22N-2 inclusive. Each edge has distinct weights.
  • The graph is formed in a way such that there is a way to assign a weight WiW_i to each edge ii in the key tree that satisfies the following conditions:
    • For each pair of edges (i,j)(i, j), if i<ji<j, then Wi<WjW_i<W_j.
    • For each pair of different vertex indices (x,y)(x, y), the cost of the only simple path from vertex xx to yy in the key tree is equal to the minimum cost of a simple circuit that goes through vertices xx and yy in the graph.
  • Note that the graph is allowed to have multi-edges, but is not allowed to have self-loops.

Print the answer modulo 998244353998\,244\,353.

Two graphs are considered distinct if and only if there exists a triple (a,b,c)(a, b, c) such that there exists an edge that connects vertices aa and bb with weight cc in one graph, but not in the other.

The first line contains a single integer NN (2N1052 \le N \le 10^5) — the number of vertices in the key tree.

The ii-th of the next N1N-1 lines contains two integers UiU_i and ViV_i (1Ui,ViN1 \le U_i, V_i \le N) — an edge connecting vertices UiU_i and ViV_i. The graph in the input is a tree.

An integer representing the number of distinct undirected weighted graphs that satisfy the conditions of the problem modulo 998244353998\,244\,353.

Input

The first line contains a single integer NN (2N1052 \le N \le 10^5) — the number of vertices in the key tree.

The ii-th of the next N1N-1 lines contains two integers UiU_i and ViV_i (1Ui,ViN1 \le U_i, V_i \le N) — an edge connecting vertices UiU_i and ViV_i. The graph in the input is a tree.

Output

An integer representing the number of distinct undirected weighted graphs that satisfy the conditions of the problem modulo 998244353998\,244\,353.

Sample Input 1

4
3 2
1 3
4 3

Sample Output 1

540

Note

The following is an example of a graph that satisfies.

The following is an assignment of edge weights in the key tree that corresponds to the graph above.

As an example, consider a pair of vertex indices (1,4)(1, 4).

  • The circuit in the graph for this pair of vertices is 322446211533 \xrightarrow{2} 2 \xrightarrow{4} 4 \xrightarrow{6} 2 \xrightarrow{1} 1 \xrightarrow{5} 3 with a cost of 66.
  • The path in the key tree for this pair of vertices is 153641 \xrightarrow{5} 3 \xrightarrow{6} 4 with a cost of 66.