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.*;

public class E {
	InputStream is;

	int __t__ = 1;
	int __f__ = 0;
	int __FILE_DEBUG_FLAG__ = __f__;
	String __DEBUG_FILE_NAME__ = "src/E2";

	FastScanner in;
	PrintWriter out;

	class LazyPropagationSegmentTree {
		int N;
		long[] lazyDat;
		long[] dat;
		
		public LazyPropagationSegmentTree(int n) {
			N = Integer.highestOneBit(n) << 1;
			int size = (N << 1) - 1;
			dat = new long[size];
			lazyDat = new long[size];
		}

		void lazyEvaluate(int k, int l, int r) {
			if (lazyDat[k] == 0) return;
			dat[k] = lazyDat[k];
			if (2 * k + 2 < 2 * N - 1) {
				lazyDat[2*k+1] = lazyDat[k];
				lazyDat[2*k+2] = lazyDat[k];
			}
			lazyDat[k] = 0;
		}
		
		void updateNode(int k) {
			assert 2 * k + 2 < 2 * N - 1;
			dat[k] = dat[2*k+1] | dat[2*k+2];
		}
		
		void rangeUpdate(int a, int b, long v, int k, int l, int r) {
			lazyEvaluate(k, l, r);
			if (r < a || b < l) return;
			
			if (a <= l && r <= b) {
				lazyDat[k] = v;
				lazyEvaluate(k, l, r);
				return;
			}
			
			int m = (l + r) / 2;
			rangeUpdate(a, b, v, 2 * k + 1, l, m);
			rangeUpdate(a, b, v, 2 * k + 2, m + 1, r);
			updateNode(k);
		}
		
		private long sumQuery(int a, int b, int k, int l, int r) {
			lazyEvaluate(k, l, r);
			
			long res = 0;
			if (r < a || b < l) res = 0;			
			else if (a <= l && r <= b) res = dat[k];
			else {
				int m = (l + r) / 2;
				long vl = sumQuery(a, b, k * 2 + 1, l, m);
				long vr = sumQuery(a, b, k * 2 + 2, m + 1, r);
				updateNode(k);
				res = vl | vr;
			}
			return res;
		}
		
		long getSumQuery(int a, int b) {
			return sumQuery(a, b, 0, 0, N - 1);
		}
		
		void updateQuery(int a, int b, long v) {
			rangeUpdate(a, b, v, 0, 0, N - 1);
		}		
	}

	void display(int[] dat) {
		System.out.println("-------------Segment Tree-------------");
		for (int i = 1; i < dat.length; i *= 2) {
			for (int j = i; j < 2 * i; j++) {
				System.out.print(dat[j-1] + " ");
			}
			System.out.println();
		}
		System.out.println("----------------End------------------");
		System.out.println();
	}
	
	ArrayList<Integer>[] g;
	
	int cur;
	int[] order, child;
	int dfs(int u, int pre) {
		int childCnt = 0;
		for (int v : g[u]) {
			if (pre == v) continue;
			childCnt += dfs(v, u) + 1;
		}
		order[u] = cur++;
		return child[u] = childCnt;
	}
	
	public void solve() {
		int n = in.nextInt(), m = in.nextInt();
		int[] c = in.nextIntArray(n);
		g = new ArrayList[n];
		
		LazyPropagationSegmentTree stree = new LazyPropagationSegmentTree(n);
		
		for (int i = 0; i < n; i++)
			g[i] = new ArrayList<Integer>();
		
		for (int i = 0; i < n - 1; i++) {
			int x = in.nextInt() - 1, y = in.nextInt() - 1;
			g[x].add(y);
			g[y].add(x);
		}
		
		cur = 0;
		order = new int[n];
		child = new int[n];
		dfs(0, -1);
		
		for (int i = 0; i < n; i++) {
			stree.updateQuery(order[i], order[i], (1L << c[i]));
		}
		
		for (int q = 0; q < m; q++) {
			int type = in.nextInt();
			if (type == 1) {
				int vk = in.nextInt() - 1, ck = in.nextInt();
				int right = order[vk], left = right - child[vk];
				stree.updateQuery(left, right, 1L << ck);
			} else if (type == 2) {
				int vk = in.nextInt() - 1;
				int right = order[vk], left = right - child[vk];
				out.println(Long.bitCount(stree.getSumQuery(left, right)));
			}
		}
		out.close();
	}

	public void run() {
		if (__FILE_DEBUG_FLAG__ == __t__) {
			try {
				is = new FileInputStream(__DEBUG_FILE_NAME__);
			} catch (FileNotFoundException e) {
				// TODO 自動生成された catch ブロック
				e.printStackTrace();
			}
			System.out.println("FILE_INPUT!");
		} else {
			is = System.in;
		}
		in = new FastScanner(is);
		out = new PrintWriter(System.out);

		solve();
	}

	public static void main(String[] args) {
		new E().run();
	}

	public void mapDebug(int[][] a) {
		System.out.println("--------map display---------");

		for (int i = 0; i < a.length; i++) {
			for (int j = 0; j < a[i].length; j++) {
				System.out.printf("%3d ", a[i][j]);
			}
			System.out.println();
		}

		System.out.println("----------------------------");
		System.out.println();
	}

	public void debug(Object... obj) {
		System.out.println(Arrays.deepToString(obj));
	}

	class FastScanner {
		private InputStream stream;
		private byte[] buf = new byte[1024];
		private int curChar;
		private int numChars;

		public FastScanner(InputStream stream) {
			this.stream = stream;
			//stream = new FileInputStream(new File("dec.in"));

		}

		int read() {
			if (numChars == -1)
				throw new InputMismatchException();
			if (curChar >= numChars) {
				curChar = 0;
				try {
					numChars = stream.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (numChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}

		boolean isSpaceChar(int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		boolean isEndline(int c) {
			return c == '\n' || c == '\r' || c == -1;
		}

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

		int[] nextIntArray(int n) {
			int[] array = new int[n];
			for (int i = 0; i < n; i++)
				array[i] = nextInt();

			return array;
		}

		int[][] nextIntMap(int n, int m) {
			int[][] map = new int[n][m];
			for (int i = 0; i < n; i++) {
				map[i] = in.nextIntArray(m);
			}
			return map;
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		long[] nextLongArray(int n) {
			long[] array = new long[n];
			for (int i = 0; i < n; i++)
				array[i] = nextLong();

			return array;
		}

		long[][] nextLongMap(int n, int m) {
			long[][] map = new long[n][m];
			for (int i = 0; i < n; i++) {
				map[i] = in.nextLongArray(m);
			}
			return map;
		}

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

		double[] nextDoubleArray(int n) {
			double[] array = new double[n];
			for (int i = 0; i < n; i++)
				array[i] = nextDouble();

			return array;
		}

		double[][] nextDoubleMap(int n, int m) {
			double[][] map = new double[n][m];
			for (int i = 0; i < n; i++) {
				map[i] = in.nextDoubleArray(m);
			}
			return map;
		}

		String next() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		String[] nextStringArray(int n) {
			String[] array = new String[n];
			for (int i = 0; i < n; i++)
				array[i] = next();

			return array;
		}

		String nextLine() {
			int c = read();
			while (isEndline(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isEndline(c));
			return res.toString();
		}
	}
}

