#Lutece1044. Kiss the princess

Kiss the princess

Migrated from Lutece 1044 Kiss the princess

All parts of this problem, including description, images, samples, data and checker, might be broken. If you find bugs in this problem, please contact the admins.

Description

There is a rooted tree with nn vertices. That is, there are exactly n1n - 1 edges and it is possible to go from any vertice to any other vertice by following some sequence of edges. The tree are numbered from 11 to nn, and the root is 11. Every vertice has a colour in the range of [1,n][1, n]. There are mm operations on the tree.

  • 0 v c : make the colour of the vertice v be c.
  • 1 v : query the number of different colours in the subtree rooted at vertice v.

Input

The first line contains a single integer nn.

Each of the following n1n - 1 lines contains 22 integers aia_i and bib_i, which denotes an edge between aia_i and bib_i.

There are nn integers in the following line. The ithi_{th} integer cic_i denotes the initial colour of the vertice numbered ii.

The following line contains a single integer mm, the number of the oprations in the following.

Then mm lines follow, each gives an operation. Each operation belongs to either kind:

  • 0 v c : make the colour of the vertice v be c.
  • 1 v : query the number of different colours in the subtree rooted at vertice v.

We guarantee that the vertices form a rooted tree and the root is at 11.

$1 \leq n, m \leq 100000, 1 \leq a_i, b_i, c_i, v, c \leq n$

Output

For each 11 vv opration, print the answer in a single line.

Samples

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

Resources

The 13th UESTC Programming Contest Preliminary