Each New Year Timofey and his friends cut down a tree of n vertices and bring it home. After that they paint all the n its vertices, so that the i-th vertex gets color ci.

Now it's time for Timofey birthday, and his mother asked him to remove the tree. Timofey removes the tree in the following way: he takes some vertex in hands, while all the other vertices move down so that the tree becomes rooted at the chosen vertex. After that Timofey brings the tree to a trash can.

Timofey doesn't like it when many colors are mixing together. A subtree annoys him if there are vertices of different color in it. Timofey wants to find a vertex which he should take in hands so that there are no subtrees that annoy him. He doesn't consider the whole tree as a subtree since he can't see the color of the root vertex.

A subtree of some vertex is a subgraph containing that vertex and all its descendants.

Your task is to determine if there is a vertex, taking which in hands Timofey wouldn't be annoyed.

Input

The first line contains single integer n (2 ≤ n ≤ 105) — the number of vertices in the tree.

Each of the next n - 1 lines contains two integers u and v (1 ≤ u, v ≤ n, u ≠ v), denoting there is an edge between vertices u and v. It is guaranteed that the given graph is a tree.

The next line contains n integers c1, c2, ..., cn (1 ≤ ci ≤ 105), denoting the colors of the vertices.

Output

Print "NO" in a single line, if Timofey can't take the tree in such a way that it doesn't annoy him.

Otherwise print "YES" in the first line. In the second line print the index of the vertex which Timofey should take in hands. If there are multiple answers, print any of them.

Examples

Input

4
1 2
2 3
3 4
1 2 1 1


Output

YES
2

Input

3
1 2
2 3
1 2 3


Output

YES
2

Input

4
1 2
2 3
3 4
1 2 1 2


Output

NO

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

public final class TaskC
{
	public static void main(String[] args)
	{
		InputReader in = new InputReader(System.in);
		PrintWriter out = new PrintWriter(System.out);
		Solver solver = new Solver(in, out);

		solver.solve();
		in.close();
		out.flush();
		out.close();
	}

	static class Solver
	{
		final int started = (int) 1e6;
		int n, col[], aa;
		List<Integer>[] adj;
		boolean[] valid, start, chained;
		boolean poss;
		InputReader in;
		PrintWriter out;

		void solve()
		{
			n = in.nextInt();
			col = new int[n];
			adj = new ArrayList[n];
			valid = new boolean[n];
			start = new boolean[n];
			chained = new boolean[n];

			for (int i = 0; i < n; i++)
				adj[i] = new ArrayList<>();

			for (int i = 1; i < n; i++)
			{
				int u = in.nextInt() - 1;
				int v = in.nextInt() - 1;

				adj[u].add(v);
				adj[v].add(u);
			}

			col = in.nextIntArray(n);
			Arrays.fill(valid, true);

			dfs(0, new HashMap<>(), -1);

			int cnt = 0;
			int at = 0;

			for (int i = 0; i < n; i++)
			{
				if (start[i])
				{
					cnt++;
					at = i;
//					System.out.println(i + " start");
				}
			}

			if (cnt > 1)
				out.println("NO");
			else
			{
				/*out.println("YES");
				out.println(at + 1);*/

				poss = true;
				Map<Integer, Integer> map = dfs2(at, -1, at);

				if (!poss || map.size() > 1)
					out.println("NO");
				else
					out.println("YES\n" + (at + 1));
			}
		}

		void dfs(int node, Map<Integer, Integer> map, int par)
		{
//			System.out.println("node :" + node + ", map : " + map);

			for (int x : adj[node])
			{
				if (x == par)
					continue;

				Map<Integer, Integer> mm = new HashMap<>();
				if (node == 0)
				{
					dfs(x, mm, node);
				}
				else
				{
					dfs(x, mm, node);
				}

				for (Map.Entry<Integer, Integer> entry : mm.entrySet())
				{
					Integer cnt = map.get(entry.getKey());

					if (cnt == null)
						map.put(entry.getKey(), entry.getValue());
					else
						map.put(entry.getKey(), cnt + entry.getValue());
				}
			}

			if (node != 0)
			{
				Integer cnt = map.get(col[node]);

				if (cnt == null)
					map.put(col[node], 1);
				else
					map.put(col[node], cnt + 1);
			}

			for (int x : adj[node])
			{
				if (x == par)
					continue;

				if (node == 0)
				{
					if (!valid[x])
					{
						valid[node] = false;
					}
				}
				else
				{
					if (!valid[x])
					{
						valid[node] = false;
					}
				}
			}

//			System.out.println("\tin " + node + ", map : " + map);

			if (valid[node])
			{
				if (map.size() > 1)
				{
					start[node] = true;
					valid[node] = false;
					chained[node] = true;
				}
			}
/*			else if (beside)
			{
				if (map.size() > 2)
				{
					chained[node] = true;
					start[node] = true;
				}
			}*/
		}

		Map<Integer, Integer> dfs2(int node, int par, int root)
		{
			Map<Integer, Integer> map = new HashMap<>();

			for (int x : adj[node])
			{
				if (x == par)
					continue;

				Map<Integer, Integer> mm = dfs2(x, node, root);

				if (mm.size() > 1)
					poss = false;

				if (node != root)
				{
					for (Map.Entry<Integer, Integer> entry : mm.entrySet())
					{
						Integer cnt = map.get(entry.getKey());

						if (cnt == null)
							map.put(entry.getKey(), entry.getValue());
						else
							map.put(entry.getKey(), cnt + entry.getValue());
					}
				}
			}

			if (node != root)
			{
				Integer cnt = map.get(col[node]);

				if (cnt == null)
					map.put(col[node], 1);
				else
					map.put(col[node], cnt + 1);
			}

//			System.out.println("node : " + node + ", map : " + map);
			if (map.size() > 1)
				poss = false;

			return map;
		}

		public Solver(InputReader in, PrintWriter out)
		{
			this.in = in;
			this.out = out;
		}

	}

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

		public InputReader(InputStream stream)
		{
			this.stream = stream;
		}

		public 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++];
		}

		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 & 15;

				c = read();
			} while (!isSpaceChar(c));

			return res * sgn;
		}

		public int[] nextIntArray(int arraySize)
		{
			int array[] = new int[arraySize];

			for (int i = 0; i < arraySize; i++)
				array[i] = nextInt();

			return array;
		}

		public long nextLong()
		{
			int c = read();

			while (isSpaceChar(c))
				c = read();

			int sign = 1;

			if (c == '-')
			{
				sign = -1;

				c = read();
			}

			long result = 0;

			do
			{
				if (c < '0' || c > '9')
					throw new InputMismatchException();

				result *= 10;
				result += c & 15;

				c = read();
			} while (!isSpaceChar(c));

			return result * sign;
		}

		public long[] nextLongArray(int arraySize)
		{
			long array[] = new long[arraySize];

			for (int i = 0; i < arraySize; i++)
				array[i] = nextLong();

			return array;
		}

		public float nextFloat()
		{
			float result, div;
			byte c;

			result = 0;
			div = 1;
			c = (byte) read();

			while (c <= ' ')
				c = (byte) read();

			boolean isNegative = (c == '-');

			if (isNegative)
				c = (byte) read();

			do
			{
				result = result * 10 + c - '0';
			} while ((c = (byte) read()) >= '0' && c <= '9');

			if (c == '.')
				while ((c = (byte) read()) >= '0' && c <= '9')
					result += (c - '0') / (div *= 10);

			if (isNegative)
				return -result;

			return result;
		}

		public double nextDouble()
		{
			double ret = 0, div = 1;
			byte c = (byte) read();

			while (c <= ' ')
				c = (byte) read();

			boolean neg = (c == '-');

			if (neg)
				c = (byte) read();

			do
			{
				ret = ret * 10 + c - '0';
			} while ((c = (byte) read()) >= '0' && c <= '9');

			if (c == '.')
				while ((c = (byte) read()) >= '0' && c <= '9')
					ret += (c - '0') / (div *= 10);

			if (neg)
				return -ret;

			return ret;
		}

		public 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();
		}

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

		public String nextLine()
		{
			int c = read();

			StringBuilder result = new StringBuilder();

			do
			{
				result.appendCodePoint(c);

				c = read();
			} while (!isNewLine(c));

			return result.toString();
		}

		public boolean isNewLine(int c)
		{
			return c == '\n';
		}

		public void close()
		{
			try
			{
				stream.close();
			}
			catch (IOException e)
			{
				e.printStackTrace();
			}
		}

	}

	static class CMath
	{
		static long power(long number, long power)
		{
			if (number == 1 || number == 0 || power == 0)
				return 1;

			if (power == 1)
				return number;

			if (power % 2 == 0)
				return power(number * number, power / 2);
			else
				return power(number * number, power / 2) * number;
		}

		static long modPower(long number, long power, long mod)
		{
			if (number == 1 || number == 0 || power == 0)
				return 1;

			number = mod(number, mod);

			if (power == 1)
				return number;

			long square = mod(number * number, mod);

			if (power % 2 == 0)
				return modPower(square, power / 2, mod);
			else
				return mod(modPower(square, power / 2, mod) * number, mod);
		}

		static long moduloInverse(long number, long mod)
		{
			return modPower(number, mod - 2, mod);
		}

		static long mod(long number, long mod)
		{
			return number - (number / mod) * mod;
		}

		static int gcd(int a, int b)
		{
			if (b == 0)
				return a;
			else
				return gcd(b, a % b);
		}

		static long min(long... arr)
		{
			long min = arr[0];

			for (int i = 1; i < arr.length; i++)
				min = Math.min(min, arr[i]);

			return min;
		}

		static long max(long... arr)
		{
			long max = arr[0];

			for (int i = 1; i < arr.length; i++)
				max = Math.max(max, arr[i]);

			return max;
		}

		static int min(int... arr)
		{
			int min = arr[0];

			for (int i = 1; i < arr.length; i++)
				min = Math.min(min, arr[i]);

			return min;
		}

		static int max(int... arr)
		{
			int max = arr[0];

			for (int i = 1; i < arr.length; i++)
				max = Math.max(max, arr[i]);

			return max;
		}

	}

}

/*

20
1 2
1 3
1 4
1 5
3 6
6 7
6 8
6 9
6 10
3 11
11 12
11 13
11 18
12 14
13 15
13 16
13 17
18 19
19 20
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 3 2 2

20
1 2
1 3
1 4
1 5
3 6
6 7
6 8
6 9
6 10
3 11
11 12
11 13
11 18
12 14
13 15
13 16
13 17
18 19
19 20
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 3 2 1

*/
