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.math.*;
import java.util.*;

public class C {
	final static int MOD = 1000000007;
	static ArrayList<ArrayList<Integer>> g = new ArrayList<>();
	static int n, leaves = 0, difColor = 0, difNode = -1;
	static int[] color;
	static boolean[] visited;

	public static void main(String[] args) throws Exception {
		FastReader in = new FastReader(System.in);
		n = in.nextInt();
		for (int i = 0; i < n; i++)
			g.add(new ArrayList<>());
		for (int i = 0; i < n - 1; i++) {
			int u = in.nextInt() - 1;
			int v = in.nextInt() - 1;
			g.get(u).add(v);
			g.get(v).add(u);
		}
		color = new int[n];
		for (int i = 0; i < n; i++)
			color[i] = in.nextInt();
		// Find a leave node
		int leave = getLeave();
		if (leave == -1) {
			if (leaves == n) {
				System.out.println("YES");
				System.out.println("1");
				return;
			}
			if (leaves == n - 1) {
				System.out.println("YES");
				for (int i = 0; i < n; i++) {
					if (g.get(i).size() > 1)
						System.out.println(i + 1);
				}
				return;
			} else {
				System.out.println("NO");
				return;
			}
		}
		// dfs connected component from the leave
		visited = new boolean[n];
		int res = dfs(leave);
		Arrays.fill(visited, false);
		if (res == -1) { // 4th case
			System.out.println("NO");
			return;
		}
		if (difNode == -1) { // 1st case
			System.out.println("YES");
			System.out.println(1);
			return;
		} else {
			if (difColor == 1) { // 2nd case
				int difNode2 = 0;
				for (int d : g.get(difNode)) {
					if (color[d] != color[difNode]) {
						difNode2 = d;
						break;
					}
				}
				if (check(difNode)) {
					System.out.println("YES");
					System.out.println(difNode + 1);
				} else if (check(difNode2)) {
					System.out.println("YES");
					System.out.println(difNode2 + 1);
				} else {
					System.out.println("NO");
				}
				return;
			} else { // 3rd case
				if (check(difNode)) {
					System.out.println("YES");
					System.out.println(difNode + 1);
				} else {
					System.out.println("NO");
				}
				return;
			}
		}
	}
	
	private static boolean check(int root) {
		visited[root] = true;
		for (int sRoot : g.get(root)) {
			boolean result = true;
			if (!dfsCheck(sRoot, result)) {
				Arrays.fill(visited, false);
				return false;
			}
		}
		Arrays.fill(visited, false);
		return true;
	}
	
	private static boolean dfsCheck(int sRoot, boolean result) {
		visited[sRoot] = true;
		for (int next : g.get(sRoot)) {
			if (visited[next])
				continue;
			if (color[next] != color[sRoot])
				return false;
			result = result && dfsCheck(next, result);
		}
		return result;
	}

	private static int getLeave() {
		for (int i = 0; i < n; i++) {
			if (g.get(i).size() == 1) {
				leaves++;
				int neighbor = g.get(i).get(0);
				if (color[neighbor] == color[i]) {
					return i;
				}
			}
		}
		return -1;
	}
	
	private static int dfs(int l) {
		visited[l] = true;
		for (int next : g.get(l)) {
			if (visited[next])
				continue;
			if (color[next] != color[l]) {
				if (difNode >= 0 && difNode != l)
					return -1;
				difNode = l;
				difColor++;
				continue;
			}
			dfs(next);
		}
		return 0;
	}

	public static long gcd(long x, long y) {
		if (x % y == 0)
			return y;
		else
			return gcd(y, x % y);
	}
	
	static long pow(long n, long p, long m) {
		long result = 1;
		if (p == 0)
			return 1;
		if (p == 1)
			return n;
		while (p != 0) {
			if (p % 2 == 1)
				result *= n;
			if (result >= m)
				result %= m;
			p >>= 1;
			n *= n;
			if (n >= m)
				n %= m;
		}
		return result;
	}
	
	static class Pair implements Comparable<Pair> {
		long a, b;
 
		public Pair(long a, long b) {
			this.a = a;
			this.b = b;
		}
 
		public int compareTo(Pair o) {
			if (this.a != o.a)
				return Long.compare(this.a, o.a);
			else
				return Long.compare(this.b, o.b);
		}
 
		public boolean equals(Object o) {
			if (o instanceof Pair) {
				Pair p = (Pair) o;
				return p.a == a && p.b == b;
			}
			return false;
		}
 
		public int hashCode() {
			return new Long(a).hashCode() * 31 + new Long(b).hashCode();
		}
		
		public String toString() {
			return "(" + this.a + "," + this.b + ")";
		}
	}

	static class FastReader {
	    private boolean finished = false;

	    private InputStream stream;
	    private byte[] buf = new byte[1024];
	    private int curChar;
	    private int numChars;
	    private SpaceCharFilter filter;

	    public FastReader(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 peek() {
	        if (numChars == -1) {
	            return -1;
	        }
	        if (curChar >= numChars) {
	            curChar = 0;
	            try {
	                numChars = stream.read(buf);
	            } catch (IOException e) {
	                return -1;
	            }
	            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 == ',') {
	                c = read();
	            }
	            if (c < '0' || c > '9') {
	                throw new InputMismatchException();
	            }
	            res *= 10;
	            res += c - '0';
	            c = read();
	        } while (!isSpaceChar(c));
	        return res * sgn;
	    }

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

	    public boolean isSpaceChar(int c) {
	        if (filter != null) {
	            return filter.isSpaceChar(c);
	        }
	        return isWhitespace(c);
	    }

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

	    private String readLine0() {
	        StringBuilder buf = new StringBuilder();
	        int c = read();
	        while (c != '\n' && c != -1) {
	            if (c != '\r') {
	                buf.appendCodePoint(c);
	            }
	            c = read();
	        }
	        return buf.toString();
	    }

	    public String nextLine() {
	        String s = readLine0();
	        while (s.trim().length() == 0)
	            s = readLine0();
	        return s;
	    }

	    public String nextLine(boolean ignoreEmptyLines) {
	        if (ignoreEmptyLines) {
	            return nextLine();
	        } else {
	            return readLine0();
	        }
	    }

	    public BigInteger nextBigInteger() {
	        try {
	            return new BigInteger(nextString());
	        } catch (NumberFormatException e) {
	            throw new InputMismatchException();
	        }
	    }

	    public char nextCharacter() {
	        int c = read();
	        while (isSpaceChar(c))
	            c = read();
	        return (char) c;
	    }

	    public double nextDouble() {
	        int c = read();
	        while (isSpaceChar(c))
	            c = read();
	        int sgn = 1;
	        if (c == '-') {
	            sgn = -1;
	            c = read();
	        }
	        double res = 0;
	        while (!isSpaceChar(c) && c != '.') {
	            if (c == 'e' || c == 'E') {
	                return res * Math.pow(10, nextInt());
	            }
	            if (c < '0' || c > '9') {
	                throw new InputMismatchException();
	            }
	            res *= 10;
	            res += c - '0';
	            c = read();
	        }
	        if (c == '.') {
	            c = read();
	            double m = 1;
	            while (!isSpaceChar(c)) {
	                if (c == 'e' || c == 'E') {
	                    return res * Math.pow(10, nextInt());
	                }
	                if (c < '0' || c > '9') {
	                    throw new InputMismatchException();
	                }
	                m /= 10;
	                res += (c - '0') * m;
	                c = read();
	            }
	        }
	        return res * sgn;
	    }

	    public boolean isExhausted() {
	        int value;
	        while (isSpaceChar(value = peek()) && value != -1)
	            read();
	        return value == -1;
	    }

	    public String next() {
	        return nextString();
	    }

	    public SpaceCharFilter getFilter() {
	        return filter;
	    }

	    public void setFilter(SpaceCharFilter filter) {
	        this.filter = filter;
	    }

	    public interface SpaceCharFilter {
	        public boolean isSpaceChar(int ch);
	    }
	}
}