You are given a tree with n vertices labeled 1 to n. Vertices 1,2,…,k are critical.
Choose any non-empty subset S⊆{1,…,n}.
For each v∈{1,…,k} define
dv=minu∈Sdist(v,u),
where dist(x,y) is the number of edges on the (unique) path between x and y in the tree.
Thus each choice of S produces a sequence (d1,d2,…,dk).
Count how many distinct sequences can appear over all non-empty S, and output the answer modulo 998244353.
Constraints
- 1≤t≤100
- 1≤n≤1000
- 1≤k≤n
- ∑n≤1000 over all test cases