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
#include <bits/stdc++.h>
using std::vector;
namespace IO_base {
const int MAXB = 1 << 18;
char gbuf[MAXB], *ps = gbuf, *pt = gbuf;
char pbuf[MAXB + 1], *pp = pbuf;
struct Flusher {
  ~Flusher() { fwrite(pbuf, 1, pp - pbuf, stdout); }
} flusher;
inline char Getchar() {
  if (ps == pt) {
    ps = gbuf;
    pt = gbuf + fread(gbuf, 1, MAXB, stdin);
  }
  return (ps == pt) ? EOF : *ps++;
}
inline void Putchar(const char &ch) {
  if (pp == pbuf + MAXB) {
    pp = pbuf;
    fwrite(pbuf, 1, MAXB, stdout);
  }
  *pp++ = ch;
}
}  // namespace IO_base
namespace IO_number {
int read() {
  int x = 0;
  char c = IO_base::Getchar();
  bool f = 0;
  while (c < '0' || c > '9')
    (c == '-') ? f = 1, c = IO_base::Getchar() : c = IO_base::Getchar();
  while (c >= '0' && c <= '9')
    x = (x << 1) + (x << 3) + (48 ^ c), c = IO_base::Getchar();
  return (f) ? -x : x;
}
void write(const int &x) {
  if (x < 0) {
    IO_base::Putchar('-');
    write(-x);
  } else {
    if (x / 10) write(x / 10);
    IO_base::Putchar('0' + x % 10);
  }
}
}  // namespace IO_number
using namespace IO_number;
const int MAXN_HLD = 4e5 + 20, MAXN_Seg = 1 << 20;
namespace HLD {
namespace Graph {
struct edge {
  int to, net;
} e[MAXN_HLD << 1];
int first[MAXN_HLD], tote;
inline void addedge(const int &u, const int &v) {
  ++tote, e[tote].to = v, e[tote].net = first[u], first[u] = tote;
  ++tote, e[tote].to = u, e[tote].net = first[v], first[v] = tote;
}
}  // namespace Graph
using namespace Graph;
namespace Seg {
int N;
long long col[MAXN_Seg];
long long tag[MAXN_Seg];
inline void pushup(const int &x) { col[x] = col[x << 1] | col[x << 1 ^ 1]; }
inline void pushdown(const int &x) {
  if (~tag[x]) {
    col[x << 1] = tag[x];
    col[(x << 1) | 1] = tag[x];
    tag[x << 1] = tag[x];
    tag[(x << 1) | 1] = tag[x];
    tag[x] = -1;
  }
}
void modify(const int &l, const int &r, const int &val, const int &nl = 1,
            const int &nr = N, const int &x = 1) {
  if (l == nl && r == nr) {
    col[x] = 1ll << val;
    tag[x] = 1ll << val;
    return;
  }
  pushdown(x);
  int mid = (nl + nr) >> 1;
  if (r <= mid)
    modify(l, r, val, nl, mid, x << 1);
  else if (l >= mid + 1)
    modify(l, r, val, mid + 1, nr, (x << 1) | 1);
  else
    modify(l, mid, val, nl, mid, x << 1),
        modify(mid + 1, r, val, mid + 1, nr, (x << 1) | 1);
  pushup(x);
}
long long query(const int &l, const int &r, const int &nl = 1,
                const int &nr = N, const int &x = 1) {
  if (l == nl && r == nr) return col[x];
  pushdown(x);
  int mid = (nl + nr) >> 1;
  if (r <= mid)
    return query(l, r, nl, mid, x << 1);
  else if (l >= mid + 1)
    return query(l, r, mid + 1, nr, (x << 1) | 1);
  else
    return query(l, mid, nl, mid, x << 1) |
           query(mid + 1, r, mid + 1, nr, (x << 1) | 1);
}
}  // namespace Seg
using namespace Seg;
namespace HLD_init {
int dfn[MAXN_HLD], DFN;
int dep[MAXN_HLD], siz[MAXN_HLD], fa[MAXN_HLD];
int ws[MAXN_HLD], topl[MAXN_HLD];
void dfs1(const int &u, const int &Fa) {
  dep[u] = dep[Fa] + 1;
  siz[u] = 1;
  fa[u] = Fa;
  for (int l = first[u]; l; l = e[l].net)
    if (e[l].to != Fa) {
      dfs1(e[l].to, u);
      siz[u] += siz[e[l].to];
      if (!ws[u] || siz[e[l].to] > siz[ws[u]]) ws[u] = e[l].to;
    }
}
void dfs2(const int &u) {
  dfn[u] = ++DFN;
  if (fa[u] == 0 || ws[fa[u]] != u)
    topl[u] = u;
  else
    topl[u] = topl[fa[u]];
  if (ws[u]) dfs2(ws[u]);
  for (int l = first[u]; l; l = e[l].net)
    if (e[l].to != fa[u] && e[l].to != ws[u]) dfs2(e[l].to);
}
}  // namespace HLD_init
using namespace HLD_init;
void Seg_init(const int &n, const vector<int> &input) {
  N = 1;
  while (N < n) N <<= 1;
  for (int i = N; i < N + n; ++i)
    col[N - 1 + dfn[i - N + 1]] = 1ll << input[i - N];
  for (int i = N - 1; i >= 1; --i) pushup(i);
  memset(tag, -1, sizeof(tag));
}
void init(const int &n) {
  vector<int> input(n);
  for (int i = 0; i < n; ++i) input[i] = read();
  for (int i = 0; i < n - 1; ++i) addedge(read(), read());
  dfs1(1, 0), dfs2(1);
  Seg_init(n, input);
}
int query_count(const long long &Col) {
  int ret = 0;
  for (long long i = 1, k = 1 << 1; i <= 60; ++i, k <<= 1)
    if (Col & k) ++ret;
  return ret;
}
int query_t(const int &x) {
  return query_count(query(dfn[x], dfn[x] + siz[x] - 1));
}
void modify_t(const int &x, const int &val) {
  modify(dfn[x], dfn[x] + siz[x] - 1, val);
}
}  // namespace HLD
int main() {
  const int n = read(), m = read();
  HLD::init(n);
  for (int tt = 0; tt < m; ++tt) {
    const int opt = read(), u = read();
    if (opt == 1)
      HLD::modify_t(u, read());
    else
      write(HLD::query_t(u)), IO_base::Putchar('\n');
  }
}
