#SGM0000086. Cây năm mới (New Year Tree)

Cây năm mới (New Year Tree)

New Year Tree

Source: Codeforces

Version: Phuoc Hung OJ Extended

Problem

Each vertex of a rooted tree has a color from 1 to 60. Support recoloring every vertex in a subtree with one color and querying the number of distinct colors in a subtree.

Input

The first line contains nn and mm. The second line contains the nn initial colors. The next n−1n-1 lines contain the tree edges. Each of the following mm lines is one of:

  • 1 v c: recolor every vertex in the subtree of vv with color cc.
  • 2 v: query the number of distinct colors in the subtree of vv.

The tree is rooted at vertex 1.

Output

For each operation of type 2, print the number of distinct colors.

Subtasks

Subtask 1 (20%)

  • The tree size and number of operations are at most 20.
  • All other conditions are the same as Subtask 3.

Subtask 2 (30%)

  • The tree size and number of operations are at most 2000.
  • All other conditions are the same as Subtask 3.

Subtask 3 (50%)

  • 1≤n,m≤4⋅1051\le n,m\le4\cdot10^5.
  • 1≤ci,c≤601\le c_i,c\le60.

Example

Input

1 15
43
2 1
2 1
2 1
2 1
2 1
1 1 13
2 1
2 1
2 1
2 1
2 1
1 1 34
2 1
2 1
2 1

Output

1
1
1
1
1
1
1
1
1
1
1
1
1

Explanation

The tree contains only one vertex, so every query reports exactly one distinct color.