There are several test cases.
For each test case,the first line contains two numbers $N$ and $Q$.
For the following $N-1$ lines,each line contains two numbers $u$ and $v$,indicating there is a edge between $u$ and $v$ in tree.
For the following $Q$ lines,each line contains some numbers,which are $K,P',T,A_1,A_2,\dots,A_K$ in order.
Let the answer of last query be $lastans$,then $P=(P' + lastAns)~\mod{N} + 1$.
If the answer of last query is -1 or it's the first query,then $lastans=0$.
Let the number of test cases be $T$,we guarantee $T=30$.
$80\%$ test cases satisfy $N,K,Q \le 10000$ ,$\sum{K} \le 20000$.
$100\%$ test cases satisfy ~$P, N,K \le 50000$,$Q \le 100000$,$\sum{K} \le 200000$.