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.util.*;
import java.io.*;
public class E 
{
	public static void main(String[] args)
	{
		new E().solve();
	}

	FasterScanner in=new FasterScanner();
	PrintWriter out=new PrintWriter(System.out);

	public void solve()
	{
		//    	int tt=in.nextInt();
		//    	for(int ii=0;ii<tt;ii++)
		{
			int n=in.nextInt();
			int m=in.nextInt();
			start=new int[n];
			stop=new int[n];
			g=new ArrayList[n];
			dfsorder=new long[n];
			color=in.nextIntArray(n);
			for(int i=0;i<n;i++)
				g[i]=new ArrayList<>();
			for(int i=0;i<n-1;i++)
			{
				int x=in.nextInt()-1;
				int y=in.nextInt()-1;
				g[x].add(y);
				g[y].add(x);
			}
			tree=new SegmentTree(n);
			dfs(0,-1);
//			System.out.println(Arrays.toString(start));
//			System.out.println(Arrays.toString(stop));
			for(int i=0;i<m;i++)
			{
				int q=in.nextInt();
				if(q==1)
				{
					int cc=in.nextInt()-1;
					long col=1L<<in.nextInt();
					tree.modify(start[cc], stop[cc], col);
				}
				else
				{
					int cc=in.nextInt()-1;
					long ans=tree.query(start[cc], stop[cc]);
					int a=0;
					for(char c:Long.toBinaryString(ans).toCharArray())
					{
						if (c=='1')
							a++;
					}
					out.println(a);
				}
			}
		}
		out.close();
	}

	SegmentTree tree;
	ArrayList<Integer>[] g;
	int[] start;
	int[] stop;
	int time=0;
	long[] dfsorder;
	int[] color;
	
	void dfs(int cur,int pa)
	{
		tree.modify(time, time, 1L<<color[cur]);
		start[cur]=time++;
	//	System.out.println(cur+" "+time);
		for(int x:g[cur])
		{
			if(x!=pa)
			{
				dfs(x,cur);
			}
		}
		stop[cur]=time-1;
	}
	
	class s implements Comparable<s>
	{
		int time;
		int floor;
		public s(int t,int f)
		{
			this.time=t;
			this.floor=f;
		}

		@Override
		public int compareTo(s o) {
			// TODO Auto-generated method stub
			if(this.floor!=o.floor)
				return Integer.compare(this.floor, o.floor);
			else
				return Integer.compare(this.time, o.time);
		}
	}

	class SegmentTree {

		// Modify the following 5 methods to implement your custom operations on the tree.
		// This example implements Add/Max operations. Operations like Add/Sum, Set/Max can also be implemented.
		long modifyOperation(long x, long y) {
			return y;
		}

		// query (or combine) operation
		long queryOperation(long leftValue, long rightValue) {
			return leftValue | rightValue;
		}

		long deltaEffectOnSegment(long delta, int segmentLength) {
			// Here you must write a fast equivalent of following slow code:
			// int result = delta;
			// for (int i = 1; i < segmentLength; i++) result = queryOperation(result, delta);
			// return result;
			return delta;
		}

		long getNeutralDelta() {
			return 0;
		}

		long getInitValue() {
			return 0;
		}

		// generic code
		int n;
		long[] value;
		long[] delta; // delta[i] affects value[i], delta[2*i+1] and delta[2*i+2]

		long joinValueWithDelta(long value, long delta) {
			if (delta == getNeutralDelta()) return value;
			return modifyOperation(value, delta);
		}

		long joinDeltas(long delta1, long delta2) {
			if (delta1 == getNeutralDelta()) return delta2;
			if (delta2 == getNeutralDelta()) return delta1;
			return modifyOperation(delta1, delta2);
		}

		void pushDelta(int root, int left, int right) {
			value[root] = joinValueWithDelta(value[root], deltaEffectOnSegment(delta[root], right - left + 1));
			delta[2 * root + 1] = joinDeltas(delta[2 * root + 1], delta[root]);
			delta[2 * root + 2] = joinDeltas(delta[2 * root + 2], delta[root]);
			delta[root] = getNeutralDelta();
		}

		public SegmentTree(int n) {
			this.n = n;
			value = new long[4 * n];
			delta = new long[4 * n];
			init(0, 0, n - 1);
		}

		void init(int root, int left, int right) {
			if (left == right) {
				value[root] = getInitValue();
				delta[root] = getNeutralDelta();
			} else {
				int mid = (left + right) >> 1;
				init(2 * root + 1, left, mid);
				init(2 * root + 2, mid + 1, right);
				value[root] = queryOperation(value[2 * root + 1], value[2 * root + 2]);
				delta[root] = getNeutralDelta();
			}
		}

		public long query(int from, int to) {
			return query(from, to, 0, 0, n - 1);
		}

		long query(int from, int to, int root, int left, int right) {
			if (from == left && to == right)
				return joinValueWithDelta(value[root], deltaEffectOnSegment(delta[root], right - left + 1));
			pushDelta(root, left, right);
			int mid = (left + right) >> 1;
			if (from <= mid && to > mid)
				return queryOperation(
						query(from, Math.min(to, mid), root * 2 + 1, left, mid),
						query(Math.max(from, mid + 1), to, root * 2 + 2, mid + 1, right));
			else if (from <= mid)
				return query(from, Math.min(to, mid), root * 2 + 1, left, mid);
			else if (to > mid)
				return query(Math.max(from, mid + 1), to, root * 2 + 2, mid + 1, right);
			else
				throw new RuntimeException("Incorrect query from " + from + " to " + to);
		}

		public void modify(int from, int to, long delta) {
			modify(from, to, delta, 0, 0, n - 1);
		}

		void modify(int from, int to, long delta, int root, int left, int right) {
			if (from == left && to == right) {
				this.delta[root] = joinDeltas(this.delta[root], delta);
				return;
			}
			pushDelta(root, left, right);
			int mid = (left + right) >> 1;
			if (from <= mid)
				modify(from, Math.min(to, mid), delta, 2 * root + 1, left, mid);
			if (to > mid)
				modify(Math.max(from, mid + 1), to, delta, 2 * root + 2, mid + 1, right);
			value[root] = queryOperation(
					joinValueWithDelta(value[2 * root + 1], deltaEffectOnSegment(this.delta[2 * root + 1], mid - left + 1)),
					joinValueWithDelta(value[2 * root + 2], deltaEffectOnSegment(this.delta[2 * root + 2], right - mid)));
		}
	}


	public static class FasterScanner {
		private byte[] buf = new byte[1024];
		private int curChar;
		private int numChars;
		public int read() {
			if (numChars == -1)
				throw new InputMismatchException();
			if (curChar >= numChars) {
				curChar = 0;
				try {
					numChars = System.in.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (numChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}
		public String nextLine() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isEndOfLine(c));
			return res.toString();
		}
		private boolean isEndOfLine(int c) {
			return c=='\n' || c=='\r' || c==-1;
		}
		public String nextString() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isSpaceChar(c));
			return res.toString();
		}
		private boolean isSpaceChar(int c) {
			return c=='\n' || c=='\r' || c==-1 || c==' ' || c=='\t';
		}
		public long nextLong() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			long res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}
		public int nextInt() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}

			int res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}
		public double nextDouble()
		{
			return Double.parseDouble(nextString());
		}
		public int[] nextIntArray(int n)
		{
			int[] arr=new int[n];
			for(int i=0;i<n;i++)
			{
				arr[i]=nextInt();
			}
			return arr;
		}
		public long[] nextLongArray(int n)
		{
			long[] arr=new long[n];
			for(int i=0;i<n;i++)
			{
				arr[i]=nextLong();
			}
			return arr;
		}
		public int[] nextIntArray10(int n)
		{
			int[] arr=new int[n+1];
			for(int i=1;i<=n;i++)
			{
				arr[i]=nextInt();
			}
			return arr;
		}
		public long[] nextLongArray10(int n)
		{
			long[] arr=new long[n+1];
			for(int i=1;i<=n;i++)
			{
				arr[i]=nextLong();
			}
			return arr;
		}
		public int[] nextIntArray11(int n)
		{
			int[] arr=new int[n+2];
			for(int i=1;i<=n;i++)
			{
				arr[i]=nextInt();
			}
			return arr;
		}
		public long[] nextLongArray11(int n)
		{
			long[] arr=new long[n+2];
			for(int i=1;i<=n;i++)
			{
				arr[i]=nextLong();
			}
			return arr;
		}
	}

}