The New Year holidays are over, but Resha doesn't want to throw away the New Year tree. He invited his best friends Kerim and Gural to help him to redecorate the New Year tree.
The New Year tree is an undirected tree with
n vertices and root in the vertex
1.
You should process the queries of the two types:
-
Change the colours of all vertices in the subtree of the vertex v to the colour c.
-
Find the number of different colours in the subtree of the vertex v.
Output
For each query of the second type print the integer
a − the number of different colours in the subtree of the vertex given in the query.
Each of the numbers should be printed on a separate line in order of query appearing in the input.
Examples
Output
6
1
3
3
2
1
2
3
5
5
1
2
2
1
1
1
2
3