ACM-ICPC Indonesia National Contest 2013

Problem H

The Shortest Problem

Time Limit: 4 seconds

Hooray! You have came to the right problem! This problem has the shortest description... at least in this contest :-)

In this task, you are given an undirected unrooted tree of N vertices and Q queries; you should process all queries one by one.

There are two types of query:

Initially all vertices have zero value.


Input

The first line of input contains an integer T (1 ≤ T ≤ 100) the number of cases. Each case begins with two integers N and Q (1 ≤ N ≤ 20,000; 1 ≤ Q ≤ 5,000) denoting the number of vertices in the tree and the number of queries respectively. The vertices are numbered from 1..N. The next N-1 lines each contains two integers ai and bi (1 ≤ ai, bi ≤ N; a ≠ b) representing an edge connecting vertex ai and vertex bi. The next Q lines contains one of the two following format:

  1. u ai bi ki (1 ≤ ai, bi ≤ N; -1,000 ≤ ki ≤ 1,000) .
  2. q
There will be at least one q query.

Warning: This problem has a large input file.


Output

For each case, output in a line "Case #X:" where X is the case number starts from 1. For each q query in the input, output in a line the highest value in any vertex in the tree at that moment.



Sample InputOutput for Sample Input
2
5 7
1 2
2 3
3 4
2 5
u 1 3 2
u 5 4 3
q
u 2 3 -4
q
u 1 1 10
q
3 5
1 2
2 3
q
u 1 2 -5
q
u 2 3 -6
q
Case #1:
5
3
12
Case #2:
0
0
-5


Explanation for the 1st sample input.

The initial condition:

After the first update (u 1 3 2):

After the second update (u 5 4 3):

q query on this tree will output 5 (node 2 and node 3 have such value).

After the third update (u 2 3 -4):

q query on this tree will output 3 (node 4 and node 5 have such value).

After the fourth update (u 1 1 10):

q query on this tree will output 12 (node 1 has such value).