You are given a tree (connected, undirected, acyclic graph) consisting of NN nodes. Based on this tree, you have to answer QQ queries.

Each query is of the form:

- K D V1 V2 ⋯ VKK D V1 V2 ⋯ VK — output the number of…

You are given a tree (connected, undirected, acyclic graph) consisting of NN nodes. Based on this tree, you have to answer QQ queries.

Each query is of the form:

- K D V1 V2 ⋯ VKK D V1 V2 ⋯ VK — output the number of…