#include <bits/stdc++.h>
using namespace std;
template <class T>
T MAX(T a, T b) {
  return a > b ? a : b;
}
template <class T>
T MIN(T a, T b) {
  return a < b ? a : b;
}
template <class T1>
void __(T1 p) {
  cout << p << endl;
}
template <class T1>
void deb(T1 p) {
  cout << "Debugging: " << p << endl;
}
template <class T1, class T2>
void deb(T1 p, T2 q) {
  cout << "Debugging: " << p << "\t" << q << endl;
}
template <class T1, class T2, class T3>
void deb(T1 p, T2 q, T3 r) {
  cout << "Debugging: " << p << "\t " << q << "\t " << r << endl;
}
template <class T1, class T2, class T3, class T4>
void deb(T1 p, T2 q, T3 r, T4 s) {
  cout << "Debugging: " << p << "\t " << q << "\t " << r << "\t " << s << endl;
}
long long int POOW(long long b, long long p) {
  if (p == 0) return 1;
  return b * POOW(b, p - 1);
}
const int first[] = {0, 0, 1, -1, -1, 1, -1, 1};
const int second[] = {1, -1, 0, 0, 1, 1, -1, -1};
const int kx[] = {-2, -1, 1, 2, 2, 1, -1, -2};
const int ky[] = {1, 2, 2, 1, -1, -2, -2, -1};
vector<int> mat[400005];
int ar[400005], in[400005], out[400005], n, flag[400005], tt;
class SEGMENT_TREE {
 public:
  long long *tree, *prop, val;
  int n, start, last;
  SEGMENT_TREE(){};
  void SET_SIZE(int sz) {
    delete (tree);
    delete (prop);
    n = sz;
    tree = new long long[n << 2];
    prop = new long long[n << 2];
  }
  void INIT(int i, int j, int node) {
    if (i == j) {
      tree[node] = (1ll << ar[flag[i]]);
      prop[node] = -1;
      return;
    }
    int left = node << 1;
    int right = left | 1;
    int mid = (i + j) >> 1;
    INIT(i, mid, left);
    INIT(mid + 1, j, right);
    tree[node] = tree[left] | tree[right];
    prop[node] = -1;
    return;
  }
  void UPDATE(int i, int j, int node) {
    if (i > last || j < start) return;
    if (i >= start and j <= last) {
      tree[node] = (1ll << val);
      prop[node] = (1ll << val);
      return;
    }
    int left = node << 1;
    int right = left | 1;
    int mid = (i + j) >> 1;
    if (prop[node] != -1) {
      tree[left] = tree[right] = prop[left] = prop[right] = prop[node];
      prop[node] = -1;
    }
    UPDATE(i, mid, left);
    UPDATE(mid + 1, j, right);
    tree[node] = tree[left] | tree[right];
    return;
  }
  long long QUERY(int i, int j, int node) {
    if (i > last or j < start) return 0;
    if (i >= start and j <= last) {
      return tree[node];
    }
    int left = node << 1;
    int right = left | 1;
    int mid = (i + j) >> 1;
    if (prop[node] != -1) {
      tree[left] = tree[right] = prop[left] = prop[right] = prop[node];
      prop[node] = -1;
    }
    long long p1 = QUERY(i, mid, left);
    long long p2 = QUERY(mid + 1, j, right);
    return p1 | p2;
  }
} tree;
void DFS(int now, int prev) {
  in[now] = tt;
  flag[tt] = now;
  tt++;
  for (int i = 0; i < mat[now].size(); i++) {
    if (mat[now][i] != prev) DFS(mat[now][i], now);
  }
  out[now] = tt;
  return;
}
int main() {
  int i, t, j, k, l, keis(0), c, d, x, y, a, b, m;
  while (cin >> n >> m) {
    tree.SET_SIZE(n + 1);
    for (i = 1; i <= n; i++) {
      mat[i].clear();
      scanf("%d", &ar[i]);
    }
    for (i = 1; i < n; i++) {
      scanf("%d", &a);
      scanf("%d", &b);
      mat[a].push_back(b);
      mat[b].push_back(a);
    }
    tt = 1;
    DFS(1, -1);
    tree.INIT(1, n, 1);
    while (m--) {
      scanf("%d", &a);
      if (a == 1) {
        scanf("%d", &b);
        scanf("%d", &c);
        tree.start = in[b];
        tree.last = out[b] - 1;
        tree.val = c;
        tree.UPDATE(1, n, 1);
      } else {
        scanf("%d", &a);
        tree.start = in[a];
        tree.last = out[a] - 1;
        long long ans = tree.QUERY(1, n, 1);
        __(__builtin_popcountll(ans));
      }
    }
  }
  return 0;
}

### Prompt

Your task is to create a Cpp solution to the following problem:

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:

  1. Change the colours of all vertices in the subtree of the vertex v to the colour c. 
  2. Find the number of different colours in the subtree of the vertex v. 

Input

The first line contains two integers n, m (1 ≤ n, m ≤ 4·105) — the number of vertices in the tree and the number of the queries.

The second line contains n integers ci (1 ≤ ci ≤ 60) — the colour of the i-th vertex.

Each of the next n - 1 lines contains two integers xj, yj (1 ≤ xj, yj ≤ n) — the vertices of the j-th edge. It is guaranteed that you are given correct undirected tree.

The last m lines contains the description of the queries. Each description starts with the integer tk (1 ≤ tk ≤ 2) — the type of the k-th query. For the queries of the first type then follows two integers vk, ck (1 ≤ vk ≤ n, 1 ≤ ck ≤ 60) — the number of the vertex whose subtree will be recoloured with the colour ck. For the queries of the second type then follows integer vk (1 ≤ vk ≤ n) — the number of the vertex for which subtree you should find the number of different colours.

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

Input

7 10
1 1 1 1 1 1 1
1 2
1 3
1 4
3 5
3 6
3 7
1 3 2
2 1
1 4 3
2 1
1 2 5
2 1
1 6 4
2 1
2 2
2 3


Output

2
3
4
5
1
2


Input

23 30
1 2 2 6 5 3 2 1 1 1 2 4 5 3 4 4 3 3 3 3 3 4 6
1 2
1 3
1 4
2 5
2 6
3 7
3 8
4 9
4 10
4 11
6 12
6 13
7 14
7 15
7 16
8 17
8 18
10 19
10 20
10 21
11 22
11 23
2 1
2 5
2 6
2 7
2 8
2 9
2 10
2 11
2 4
1 12 1
1 13 1
1 14 1
1 15 1
1 16 1
1 17 1
1 18 1
1 19 1
1 20 1
1 21 1
1 22 1
1 23 1
2 1
2 5
2 6
2 7
2 8
2 9
2 10
2 11
2 4


Output

6
1
3
3
2
1
2
3
5
5
1
2
2
1
1
1
2
3

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
template <class T>
T MAX(T a, T b) {
  return a > b ? a : b;
}
template <class T>
T MIN(T a, T b) {
  return a < b ? a : b;
}
template <class T1>
void __(T1 p) {
  cout << p << endl;
}
template <class T1>
void deb(T1 p) {
  cout << "Debugging: " << p << endl;
}
template <class T1, class T2>
void deb(T1 p, T2 q) {
  cout << "Debugging: " << p << "\t" << q << endl;
}
template <class T1, class T2, class T3>
void deb(T1 p, T2 q, T3 r) {
  cout << "Debugging: " << p << "\t " << q << "\t " << r << endl;
}
template <class T1, class T2, class T3, class T4>
void deb(T1 p, T2 q, T3 r, T4 s) {
  cout << "Debugging: " << p << "\t " << q << "\t " << r << "\t " << s << endl;
}
long long int POOW(long long b, long long p) {
  if (p == 0) return 1;
  return b * POOW(b, p - 1);
}
const int first[] = {0, 0, 1, -1, -1, 1, -1, 1};
const int second[] = {1, -1, 0, 0, 1, 1, -1, -1};
const int kx[] = {-2, -1, 1, 2, 2, 1, -1, -2};
const int ky[] = {1, 2, 2, 1, -1, -2, -2, -1};
vector<int> mat[400005];
int ar[400005], in[400005], out[400005], n, flag[400005], tt;
class SEGMENT_TREE {
 public:
  long long *tree, *prop, val;
  int n, start, last;
  SEGMENT_TREE(){};
  void SET_SIZE(int sz) {
    delete (tree);
    delete (prop);
    n = sz;
    tree = new long long[n << 2];
    prop = new long long[n << 2];
  }
  void INIT(int i, int j, int node) {
    if (i == j) {
      tree[node] = (1ll << ar[flag[i]]);
      prop[node] = -1;
      return;
    }
    int left = node << 1;
    int right = left | 1;
    int mid = (i + j) >> 1;
    INIT(i, mid, left);
    INIT(mid + 1, j, right);
    tree[node] = tree[left] | tree[right];
    prop[node] = -1;
    return;
  }
  void UPDATE(int i, int j, int node) {
    if (i > last || j < start) return;
    if (i >= start and j <= last) {
      tree[node] = (1ll << val);
      prop[node] = (1ll << val);
      return;
    }
    int left = node << 1;
    int right = left | 1;
    int mid = (i + j) >> 1;
    if (prop[node] != -1) {
      tree[left] = tree[right] = prop[left] = prop[right] = prop[node];
      prop[node] = -1;
    }
    UPDATE(i, mid, left);
    UPDATE(mid + 1, j, right);
    tree[node] = tree[left] | tree[right];
    return;
  }
  long long QUERY(int i, int j, int node) {
    if (i > last or j < start) return 0;
    if (i >= start and j <= last) {
      return tree[node];
    }
    int left = node << 1;
    int right = left | 1;
    int mid = (i + j) >> 1;
    if (prop[node] != -1) {
      tree[left] = tree[right] = prop[left] = prop[right] = prop[node];
      prop[node] = -1;
    }
    long long p1 = QUERY(i, mid, left);
    long long p2 = QUERY(mid + 1, j, right);
    return p1 | p2;
  }
} tree;
void DFS(int now, int prev) {
  in[now] = tt;
  flag[tt] = now;
  tt++;
  for (int i = 0; i < mat[now].size(); i++) {
    if (mat[now][i] != prev) DFS(mat[now][i], now);
  }
  out[now] = tt;
  return;
}
int main() {
  int i, t, j, k, l, keis(0), c, d, x, y, a, b, m;
  while (cin >> n >> m) {
    tree.SET_SIZE(n + 1);
    for (i = 1; i <= n; i++) {
      mat[i].clear();
      scanf("%d", &ar[i]);
    }
    for (i = 1; i < n; i++) {
      scanf("%d", &a);
      scanf("%d", &b);
      mat[a].push_back(b);
      mat[b].push_back(a);
    }
    tt = 1;
    DFS(1, -1);
    tree.INIT(1, n, 1);
    while (m--) {
      scanf("%d", &a);
      if (a == 1) {
        scanf("%d", &b);
        scanf("%d", &c);
        tree.start = in[b];
        tree.last = out[b] - 1;
        tree.val = c;
        tree.UPDATE(1, n, 1);
      } else {
        scanf("%d", &a);
        tree.start = in[a];
        tree.last = out[a] - 1;
        long long ans = tree.QUERY(1, n, 1);
        __(__builtin_popcountll(ans));
      }
    }
  }
  return 0;
}

```