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.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;

public class ProblemC7 {
    BufferedReader rd;

    ProblemC7() throws IOException {
        rd = new BufferedReader(new InputStreamReader(System.in));
        compute();
    }

    private void compute() throws IOException {
        int n = pint();
        Solver solver = new Solver(n);
        for (int i = 0; i < n - 1; i++) {
            int[] a = intarr();
            a[0]--;
            a[1]--;
            solver.addEdge(a[0],a[1]);
        }
        int[] c = intarr();
        int res = solver.solve(c);
        out(res != -1?"YES":"NO");
        if(res != -1) {
            out(res+1);
        }
    }

    private class Solver {
        int n;
        List<Set<Integer>> e = new ArrayList<>();
        int[] c;

        private Solver(int n) {
            this.n = n;
            for (int i = 0; i < n; i++) {
                e.add(new HashSet<>());
            }
        }

        private int solve(int[] c) {
            this.c = c;
            DisjointSetForest f = reduce();
            return checkRootExists(f);
        }

        private int checkRootExists(DisjointSetForest f) {
            Set<Integer> diff = new HashSet<>();
            for(int i=0;i<n;i++) {
                diff.add(f.find(i));
            }
            Map<Integer, Set<Integer>> e2 = new HashMap<>();
            for(Integer ver: diff) {
                e2.put(ver, new HashSet<>());
            }

            for(int i=0;i<n;i++) {
                for(Integer j: e.get(i)) {
                    int u = f.find(i);
                    int v = f.find(j);
                    if(u != v) {
                        e2.get(u).add(v);
                        e2.get(v).add(u);
                    }
                }
            }

            if(e2.size() <= 1) {
                return 0;
            }
            if(e2.size() == 2) {
                for(int i=0;i<n;i++) {
                    for(Integer u: e.get(i)) {
                        if(f.find(i) != f.find(u)) {
                            return u;
                        }
                    }
                }
                return -1;
            }

            Integer big = null;
            for(Map.Entry<Integer, Set<Integer>> ee: e2.entrySet()) {
                if (ee.getValue().size() > 1) {
                    if (big != null) {
                        return -1;
                    }
                    big = ee.getKey();
                }
            }
            for(int i=0;i<n;i++) {
                int g = f.find(i);
                if(big.equals(g)) {
                    Set<Integer> zz = new HashSet<>();
                    zz.add(g);
                    for(Integer u: e.get(i)) {
                        zz.add(f.find(u));
                    }
                    if(zz.size() >= e2.size()) {
                        return i;
                    }
                }
            }
            return -1;
        }

        private DisjointSetForest reduce() {
            DisjointSetForest f = new DisjointSetForest(n);
            Queue<Integer> q = new ArrayDeque<>();
            Queue<Integer> toProcess = new ArrayDeque<>();
            boolean[] vs = new boolean[n];
            toProcess.add(0);
            vs[0] = true;
            while (!toProcess.isEmpty()) {
                int start = toProcess.poll();
                vs[start] = true;
                int color = c[start];
                q.add(start);
                while (!q.isEmpty()) {
                    int u = q.poll();
                    for (Integer v : e.get(u)) {
                        if(!vs[v]) {
                            vs[v] = true;
                            if (c[v] == color) {
                                f.union(start, v);
                                q.add(v);
                            } else {
                                toProcess.add(v);
                            }
                        }
                    }
                }
            }
            return f;
        }

        private void addEdge(int u, int v) {
            e.get(u).add(v);
            e.get(v).add(u);
        }
    }

    private static class DisjointSetForest {
        int[] p;
        int[] rank;

        public DisjointSetForest(int n) {
            p = new int[n];
            for(int i=0;i<n;i++) {
                p[i] = i;
            }
            rank = new int[n];
        }

        public int find(int x) {
            if(p[x] == x) {
                return x;
            }
            if(p[p[x]] == p[x]) {
                return p[x];
            }
            List<Integer> q = new ArrayList<>();
            int u = x;
            while(u != p[u]) {
                q.add(u);
                u = p[u];
            }
            for(Integer z: q) {
                p[z] = u;
            }
            return u;
        }

        public void union(int a, int b) {
            link(find(a), find(b));
        }

        private void link(int x, int y) {
            if(rank[x] > rank[y]) {
                p[y] = x;
            } else {
                p[x] = y;
                if(rank[x] == rank[y]) {
                    rank[y]++;
                }
            }
        }

        public String toString() {
            Map<Integer, Set<Integer>> sets = new HashMap<>();
            for(int i=0;i<p.length;i++) {
                int key = find(i);
                Set<Integer> s = sets.get(key);
                if(s == null) {
                    s = new TreeSet<>();
                    sets.put(key, s);
                }
                s.add(i);
            }
            StringBuilder buf = new StringBuilder();
            buf.append("{ ");
            boolean first = true;
            for(Map.Entry<Integer, Set<Integer>> e: sets.entrySet()) {
                if(first) {
                    first = false;
                } else {
                    buf.append(", ");
                }
                buf.append("{ ");
                boolean first2 = true;
                for(Integer v: e.getValue()) {
                    if(first2) {
                        first2 = false;
                    } else {
                        buf.append(", ");
                    }
                    buf.append(v);
                }
                buf.append(" }");
            }
            buf.append(" }");
            return buf.toString();
        }
    }

    class Pair {
        final int[] v;

        Pair(int a, int b) {
            v = new int[] { a, b };
        }

        Pair(int[] x) {
            v = x;
        }

        public boolean equals(Object o) {
            if (this == o) return true;
            if (o instanceof Pair) {
                return Arrays.equals(v, ((Pair) o).v);
            }
            return false;
        }

        public int hashCode() {
            return v != null ? Arrays.hashCode(v) : 0;
        }

        public String toString() {
            return Arrays.toString(v);
        }
    }

    private int pint() throws IOException {
        return pint(rd.readLine());
    }

    private int pint(String s) {
        return Integer.parseInt(s);
    }

    private int[] intarr() throws IOException {
        return intarr(rd.readLine());
    }

    private int[] intarr(String s) {
        String[] q = split(s);
        int n = q.length;
        int[] a = new int[n];
        for(int i=0;i<n;i++) {
            a[i] = Integer.parseInt(q[i]);
        }
        return a;
    }

    private String[] split(String s) {
        if(s == null) {
            return new String[0];
        }
        int n = s.length();
        int start = -1;
        int end = 0;
        int sp = 0;
        boolean lastWhitespace = true;
        for(int i=0;i<n;i++) {
            char c = s.charAt(i);
            if(isWhitespace(c)) {
                lastWhitespace = true;
            } else {
                if(lastWhitespace) {
                    sp++;
                }
                if(start == -1) {
                    start = i;
                }
                end = i;
                lastWhitespace = false;
            }
        }
        if(start == -1) {
            return new String[0];
        }
        String[] res = new String[sp];
        int last = start;
        int x = 0;
        lastWhitespace = true;
        for(int i=start;i<=end;i++) {
            char c = s.charAt(i);
            boolean w = isWhitespace(c);
            if(w && !lastWhitespace) {
                res[x++] = s.substring(last,i);
            } else if(!w && lastWhitespace) {
                last = i;
            }
            lastWhitespace = w;
        }
        res[x] = s.substring(last,end+1);
        return res;
    }

    private boolean isWhitespace(char c) {
        return c==' ' || c=='\t';
    }

    private static void out(Object x) {
        System.out.println(x);
    }

    public static void main(String[] args) throws IOException {
        new ProblemC7();
    }
}
