#3637. Query on a tree VI

Query on a tree VI

Description

You are given a tree (an acyclic undirected connected graph) with nn nodes. The tree nodes are numbered from 11 to nn.

Each node has a color, white or black. All the nodes are black initially.

We will ask you to perfrom some instructions of the following form:

  • 0 u: ask for how many nodes are connected to uu, two nodes are connected if all the node on the path from uu to vv (inclusive uu and vv) have a same color.
  • 1 u: toggle the color of uu (that is, from black to white, or from white to black).

Input

The first line contains a number n denoted how many nodes in the tree (1n1051\leq n\leq 10^5). The next n1n-1 lines, each line has two numbers (u,v)(u, v) describe a edge of the tree (1u,vn1\leq u,v\leq n). The next line contains a number mm denoted how many operations we are going to process (1m1051\leq m\leq 10^5). The next mm lines, each line describe a operation (t,u)(t,u) as we mentioned above (0t10\leq t\leq 1, 1un1\leq u\leq n).

Output

For each query operation, output the corresponding result.

5
1 2
1 3
1 4
1 5
3
0 1
1 1
0 1
5
1