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
//5
//1 2 3 4 1

import java.util.*;
import java.io.*;

public class Solution {
    static class Node {
        boolean pending;
        long value;
        int segmentStart;
        int segmentEnd;
    }

    static ArrayList<ArrayList<Integer>> tree;

    static int pos;

    static void dfs(int nodeId, int prevNodeId) {
        ++pos;
        segmentTree[leafs + pos].value = masks[colors[nodeId] - 1];
        if (firstPos[nodeId] == 0) {
            firstPos[nodeId] = pos;
        }

        boolean isLeaf = true;
        for (Integer next : tree.get(nodeId)) {
          if (next != prevNodeId) {
            isLeaf = false;
            dfs(next, nodeId);
          }
        }

        if (!isLeaf) {
          ++pos;
          segmentTree[leafs + pos].value = masks[colors[nodeId] - 1];
        }
        lastPos[nodeId] = pos;
    }

    static void buildSegmentTree() {
        for (int i = leafs; i < segmentTree.length; ++i) {
            segmentTree[i].segmentStart = i - leafs;
            segmentTree[i].segmentEnd = i - leafs;
        }
        for (int i = leafs - 1; i >= 1; --i) {
            segmentTree[i] = new Node();
            int leftChildIndex = 2 * i;
            int rightChildIndex = 2 * i + 1;
            segmentTree[i].segmentStart = segmentTree[leftChildIndex].segmentStart;
            segmentTree[i].segmentEnd = segmentTree[rightChildIndex].segmentEnd;
            segmentTree[i].value = segmentTree[leftChildIndex].value | segmentTree[rightChildIndex].value;
        }
    }

    static int query(int l, int r) {
      long colors = query(l, r, 1);
      int count = 0;
      while (colors > 0) {
        ++count;
        colors = colors & (colors - 1);
      }
      return count;
    }

    static long query(int l, int r, int id) {
      if (id >= segmentTree.length || r < segmentTree[id].segmentStart || l > segmentTree[id].segmentEnd) {
        return 0;
      }
      propagate(id);
      if (l <= segmentTree[id].segmentStart && r >= segmentTree[id].segmentEnd) {
        return segmentTree[id].value;
      }
      return query(l, r, 2 * id) | query(l, r, 2 * id + 1);
    }

    static boolean isLeaf(int id) {
      return id * 2 + 1 >= segmentTree.length;
    }

    static void paint(int l, int r, int id, long color) {
        if (id >= segmentTree.length || r < segmentTree[id].segmentStart || l > segmentTree[id].segmentEnd) {
            return;
        }

        int leftChildId = 2 * id;
        int rightChildId = 2 * id + 1;
        if (l <= segmentTree[id].segmentStart && r >= segmentTree[id].segmentEnd) {
            segmentTree[id].pending = false;
            segmentTree[id].value = color;
            if (!isLeaf(id)) {
              segmentTree[leftChildId].pending = true;
              segmentTree[leftChildId].value = color;
              segmentTree[rightChildId].pending = true;
              segmentTree[rightChildId].value = color;
            }
            return;
        }
        propagate(id);

        if (isLeaf(id)) {
          return;
        }

        paint(l, r, leftChildId, color);
        paint(l, r, rightChildId, color);

        segmentTree[id].value = getValue(leftChildId) | getValue(rightChildId);
    }
    
    static void propagate(int id) {
      if (segmentTree[id].pending == false) {
        return;
      }
      if (!isLeaf(id)) {
        int leftChildId = 2 * id;
        segmentTree[leftChildId].pending = segmentTree[id].pending;
        segmentTree[leftChildId].value = segmentTree[id].value;
        int rightChildId = leftChildId + 1;
        segmentTree[rightChildId].pending = segmentTree[id].pending;
        segmentTree[rightChildId].value = segmentTree[id].value;
      }
      segmentTree[id].pending = false;
    }

    static long getValue(int id) {
      propagate(id);
      return segmentTree[id].value;
    }

    static void dumpSegmentTree() {
      System.out.println("DUMPING SEGMENT TREE WITH " + leafs + " LEAFS !!!");
      for (int i = 1; i < segmentTree.length; ++i) {
        System.out.println("[" + segmentTree[i].segmentStart + ", " + segmentTree[i].segmentEnd
            + "] = {" + segmentTree[i].pending + ", "
            + Integer.toBinaryString((int)segmentTree[i].value) + "}");
      }
    }

    public static void main(String[] args) {
        MyScanner sc = new MyScanner();
        int n = sc.nextInt();
        int m = sc.nextInt();
        colors = new int[n + 1];
        tree = new ArrayList<ArrayList<Integer>>();
        tree.add(null);
        for (int i = 1; i <= n; ++i) {
            colors[i] = sc.nextInt();
            tree.add(new ArrayList<Integer>());
        }
        for (int i = 1; i < n; ++i) {
            int a = sc.nextInt();
            int b = sc.nextInt();
            tree.get(a).add(b);
            tree.get(b).add(a);
        }
        firstPos = new int[n + 1];
        Arrays.fill(firstPos, 0);
        lastPos = new int[n + 1];
        Arrays.fill(lastPos, 0);
        leafs = 1 << ((int)(Math.log(2 * n) / Math.log(2)) + 1);
        segmentTree = new Node[leafs * 2];
        for (int i = leafs; i < segmentTree.length; ++i) {
          segmentTree[i] = new Node();
        }
        masks = new long[61];
        masks[0] = 1;
        for (int i = 1; i < masks.length; ++i) {
          masks[i] = masks[i - 1] << 1;
        }
        pos = -1;
        dfs(1, 0);
        tree.clear();

        buildSegmentTree();

        out = new PrintWriter(new BufferedOutputStream(System.out));
        for (int i = 0; i < m; ++i) {
            int command = sc.nextInt();
            if (command == 1) {
                int node = sc.nextInt();
                int color = sc.nextInt();
                long colorMask = masks[color - 1];
                //System.out.println("Painting [" + firstPos[node] + ", " + lastPos[node] + "] to " + Integer.toBinaryString((int)colorMask));
                paint(firstPos[node], lastPos[node], 1, colorMask);
                //dumpSegmentTree();
            } else {
                int node = sc.nextInt();
                //System.out.println("Counting [" + firstPos[node] + ", " + lastPos[node] + "]");
                int count = query(firstPos[node], lastPos[node]);
                out.println(count);
            }
        }
        out.close();
    }
    
    static long[] masks;

    static int[] firstPos;
    static int[] lastPos;
    static int[] colors;
    
    static Node[] segmentTree;
    static int leafs;

 //-----------PrintWriter for faster output---------------------------------
   public static PrintWriter out;
      
   //-----------MyScanner class for faster input----------
   public static class MyScanner {
      BufferedReader br;
      StringTokenizer st;
 
      public MyScanner() {
         br = new BufferedReader(new InputStreamReader(System.in));
      }
 
      String next() {
          while (st == null || !st.hasMoreElements()) {
              try {
                  st = new StringTokenizer(br.readLine());
              } catch (IOException e) {
                  e.printStackTrace();
              }
          }
          return st.nextToken();
      }
 
      int nextInt() {
          return Integer.parseInt(next());
      }
 
      long nextLong() {
          return Long.parseLong(next());
      }
 
      double nextDouble() {
          return Double.parseDouble(next());
      }
 
      String nextLine(){
          String str = "";
	  try {
	     str = br.readLine();
	  } catch (IOException e) {
	     e.printStackTrace();
	  }
	  return str;
      }

   }
   //--------------------------------------------------------
}