The Number Of Black Edges
时间限制:C/C++/Rust/Pascal 1秒,其他语言2秒
空间限制:C/C++/Rust/Pascal 256 M,其他语言512 M
64bit IO Format: %lld

题目描述

Alice is given a tree with n nodes indexed from 1 to n. Each edge on the tree can be either black or white, and all edges are initially white.

There are three kinds of operations:

1. Change the color of an edge to black.
2. Change the color of an edge to white.
3. Given a node index, count the sum of the number of black edges on the simple path from all odd-indexed nodes to that node.

Note that a simple path is a path between two nodes that does not visit any node more than once.


输入描述:

The first line contains two integers n (1 \leq n \leq 100,000) and m (1 \leq m \leq 100,000), separated by a space. Here, n represents the number of nodes on the tree, and m represents the total number of operations.

Next, there are n-1 lines, where the i-th line contains two integers u and v (1 \leq u, v \leq n), representing the two nodes connected by the i-th edge on the tree. Following these are m lines, each representing one operation. The format of each operation is as follows:

- 1 x: Assign the color black to the edge indexed by x.

- 2 x: Assign the color white to the edge indexed by x.

- 3 x: Count the sum of the number of black edges on the simple path from all odd-indexed nodes to the node indexed by x.

输出描述:

For each operation 3, output a single integer in a line, indicating the sum of the number of black edges on the simple path from all odd-indexed nodes to the node indexed by x, where x is the parameter of the operation.
示例1

输入

复制
5 5
1 2
1 3
1 4
1 5
1 1
3 2
3 3
2 1
3 2

输出

复制
3
0
0
示例2

输入

复制
11 10
11 2
10 2
1 5
1 4
2 6
4 9
8 5
5 7
2 3
2 1
2 9
2 1
1 1
3 3
1 1
1 8
1 5
2 10
1 8
3 8

输出

复制
1
2