This problem is inspired by problem G. So you need to read the statement of it in order to solve this problem. You are given a tree with n vertices. Assume p is a permutation from 0 to n-1. We define a function fas follows: Assume the given tree is the input graph of problem G, and p is the input operator sequence. fis the number of operations satisfying the condition: When doing the i-th operation, there is at least one vertex belongs to group oio_ioi. Let S be the set of all possible permutation from 0 to n-1. Please calculate mod998,244,353 mod 998,244,353mod998,244,353.
This problem is inspired by problem G(Operating on the Graph). So you need to read the statement of it in order to solve this problem. You are given a tree with n vertices. Assume p is a permutation from 0 to n-1. We define a function f(p) as follows: Assume the given tree is the input graph of problem G, and p is the input operator sequence. f(p) is the number of operations satisfying the condition: When doing the i-th operation, there is at least one vertex belongs to group oio_ioi. Let S be the set of all possible permutation from 0 to n-1. Please calculate (∑p∈Sf(p))mod 998,244,353(sum_{p in S} f(p)) mod 998,244,353(∑p∈Sf(p))mod998,244,353.