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
import java.io.*;
import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;

public class _620E {

    static class SegmentTree {
        int[] begin, end;
        long[] bit;
        boolean[] needToPush;


        public SegmentTree(int[] a) {
            int n = a.length;
            begin = new int[4 * n];
            end = new int[4 * n];
            bit = new long[4 * n];
            needToPush = new boolean[4 * n];
            build(1, 0, n - 1, a);
        }

        private void build(int i, int l, int r, int[] a) {
            begin[i] = l;
            end[i] = r;
            if (l < r) {
                int mid = (l + r) / 2;
                build(2 * i, l, mid, a);
                build(2 * i + 1, mid + 1, r, a);
                bit[i] = bit[2 * i] | bit[2 * i + 1];
            } else {
                bit[i] = 1L << a[l];
            }
        }

        private void push(int i) {
            if (!needToPush[i]) return;
            if (begin[i] < end[i]) {
                bit[2 * i] = bit[2 * i + 1] = bit[i];
                needToPush[2 * i] = needToPush[2 * i + 1] = true;
            }
            needToPush[i] = false;
        }

        public void update(int i, int l, int r, int val) {
            push(i);
            if (begin[i] > r || end[i] < l) return;
            else if (l <= begin[i] && end[i] <= r) {
                bit[i] = 1L << val;
                needToPush[i] = true;
                push(i);
            } else {
                update(2 * i, l, r, val);
                update(2 * i + 1, l, r, val);
                bit[i] = bit[2 * i] | bit[2 * i + 1];
            }
        }

        public long query(int i, int l, int r) {
            push(i);
            if (begin[i] > r || end[i] < l) return 0;
            else if (l <= begin[i] && end[i] <= r) return bit[i];
            else return query(2 * i, l, r) | query(2 * i + 1, l, r);
        }
    }

    static List<Integer>[] g;
    static int[] c, beginTime, endTime, cc;
    static int n, m, globalTime;

    static void dfs(int u, int parent) {
        cc[globalTime] = c[u];
        beginTime[u] = globalTime++;
        for (int v : g[u])
            if (v != parent) dfs(v, u);
        endTime[u] = globalTime - 1;
    }

    public static void main(String[] args) throws Exception {
        Reader.init(System.in);
        BufferedWriter cout = new BufferedWriter(new OutputStreamWriter(System.out));

        n = Reader.nextInt();
        m = Reader.nextInt();
        c = new int[n];
        for (int i = 0; i < n; i++) c[i] = Reader.nextInt();

        g = new List[n];
        for (int i = 0; i < n; i++) g[i] = new ArrayList<>(1);
        for (int i = 0; i < n - 1; i++) {
            int u = Reader.nextInt() - 1;
            int v = Reader.nextInt() - 1;
            g[u].add(v);
            g[v].add(u);
        }

        beginTime = new int[n];
        endTime = new int[n];
        cc = new int[n];
        dfs(0, -1);

        StringBuilder builder = new StringBuilder();
        SegmentTree segmentTree = new SegmentTree(cc);
        for (int i = 0; i < m; i++) {
            if (Reader.nextInt() == 1) {
                int v = Reader.nextInt() - 1;
                int vc = Reader.nextInt();
                segmentTree.update(1, beginTime[v], endTime[v], vc);
            } else {
                int v = Reader.nextInt() - 1;
                long mask = segmentTree.query(1, beginTime[v], endTime[v]);
                builder.append(String.format("%d%n", Long.bitCount(mask)));
            }
        }
        cout.write(builder.toString());

        cout.close();
    }

    static class Pair<U extends Comparable<U>, V extends Comparable<V>> implements Comparable<Pair<U, V>> {
        final U _1;
        final V _2;

        private Pair(U key, V val) {
            this._1 = key;
            this._2 = val;
        }

        public static <U extends Comparable<U>, V extends Comparable<V>> Pair<U, V> instanceOf(U _1, V _2) {
            return new Pair<U, V>(_1, _2);
        }

        @Override
        public String toString() {
            return _1 + " " + _2;
        }

        @Override
        public int hashCode() {
            int res = 17;
            res = res * 31 + _1.hashCode();
            res = res * 31 + _2.hashCode();
            return res;
        }

        @Override
        public int compareTo(Pair<U, V> that) {
            int res = this._1.compareTo(that._1);
            if (res < 0 || res > 0) return res;
            else return this._2.compareTo(that._2);
        }

        @Override
        public boolean equals(Object obj) {
            if (this == obj) return true;
            if (!(obj instanceof Pair)) return false;
            Pair<?, ?> that = (Pair<?, ?>) obj;
            return _1.equals(that._1) && _2.equals(that._2);
        }
    }

    /**
     * Class for buffered reading int and double values
     */
    static class Reader {
        static BufferedReader reader;
        static StringTokenizer tokenizer;

        /**
         * call this method to initialize reader for InputStream
         */
        static void init(InputStream input) {
            reader = new BufferedReader(new InputStreamReader(input));
            tokenizer = new StringTokenizer("");
        }

        /**
         * get next word
         */
        static String next() throws IOException {
            while (!tokenizer.hasMoreTokens()) {
                // TODO add check for eof if necessary
                tokenizer = new StringTokenizer(reader.readLine());
            }
            return tokenizer.nextToken();
        }

        static int nextInt() throws IOException {
            return Integer.parseInt(next());
        }

        static double nextDouble() throws IOException {
            return Double.parseDouble(next());
        }
    }

    static class ArrayUtil {
        static void swap(int[] a, int i, int j) {
            int tmp = a[i];
            a[i] = a[j];
            a[j] = tmp;
        }

        static void swap(long[] a, int i, int j) {
            long tmp = a[i];
            a[i] = a[j];
            a[j] = tmp;
        }

        static void swap(double[] a, int i, int j) {
            double tmp = a[i];
            a[i] = a[j];
            a[j] = tmp;
        }

        static void swap(char[] a, int i, int j) {
            char tmp = a[i];
            a[i] = a[j];
            a[j] = tmp;
        }

        static void swap(boolean[] a, int i, int j) {
            boolean tmp = a[i];
            a[i] = a[j];
            a[j] = tmp;
        }

        static void reverse(int[] a, int i, int j) {
            for (; i < j; i++, j--)
                swap(a, i, j);
        }

        static void reverse(long[] a, int i, int j) {
            for (; i < j; i++, j--)
                swap(a, i, j);
        }

        static void reverse(double[] a, int i, int j) {
            for (; i < j; i++, j--)
                swap(a, i, j);
        }

        static void reverse(char[] a, int i, int j) {
            for (; i < j; i++, j--)
                swap(a, i, j);
        }

        static void reverse(boolean[] a, int i, int j) {
            for (; i < j; i++, j--)
                swap(a, i, j);
        }

        static long sum(int[] a) {
            int sum = 0;
            for (int i : a)
                sum += i;
            return sum;
        }

        static long sum(long[] a) {
            long sum = 0;
            for (long i : a)
                sum += i;
            return sum;
        }

        static double sum(double[] a) {
            double sum = 0;
            for (double i : a)
                sum += i;
            return sum;
        }

        static int max(int[] a) {
            int max = Integer.MIN_VALUE;
            for (int i : a)
                if (i > max) max = i;
            return max;
        }

        static int min(int[] a) {
            int min = Integer.MAX_VALUE;
            for (int i : a)
                if (i < min) min = i;
            return min;
        }

        static long max(long[] a) {
            long max = Long.MIN_VALUE;
            for (long i : a)
                if (i > max) max = i;
            return max;
        }

        static long min(long[] a) {
            long min = Long.MAX_VALUE;
            for (long i : a)
                if (i < min) min = i;
            return min;
        }
    }
}

