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 *c*<sub class="lower-index">*i*</sub>.

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.
The first line contains single integer *n* (2 ≤ *n* ≤ 10<sup class="upper-index">5</sup>) — 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 *c*<sub class="lower-index">1</sub>, *c*<sub class="lower-index">2</sub>, ..., *c*<sub class="lower-index">*n*</sub> (1 ≤ *c*<sub class="lower-index">*i*</sub> ≤ 10<sup class="upper-index">5</sup>), denoting the colors of the vertices.
none
4
1 2
2 3
3 4
1 2 1 1
YES
2
3
1 2
2 3
1 2 3
YES
2
4
1 2
2 3
3 4
1 2 1 2
NO
3
2 1
2 3
1 2 3
YES
2
4
1 2
2 4
4 3
1 1 3 2
YES
4
2
1 2
1 1
YES
1
10
5 7
4 5
10 2
3 6
1 2
3 4
8 5
4 9
2 3
15 15 15 15 5 15 26 18 15 15
YES
5
8
1 2
1 3
3 5
3 6
1 4
4 7
4 8
1 3 1 1 1 1 1 2
NO
3
2 1
2 3
4 4 4
YES
1
3
1 2
1 3
1 2 2
YES
1
4
1 4
2 4
3 4
1 2 3 1
YES
4
4
1 2
1 3
1 4
1 2 3 4
YES
1
9
1 2
2 3
3 4
4 5
2 7
7 6
2 8
8 9
1 1 2 2 2 3 3 4 4
YES
2
3
2 1
2 3
4 4 5
YES
2
4
1 2
2 3
3 4
1 2 2 1
NO
import sys
from collections import defaultdict
from  collections import deque
from types import GeneratorType
input = sys.stdin.readline

def bootstrap(f, stack=[]):
    
    def wrappedfunc(*args, **kwargs):
        if stack:
            return f(*args, **kwargs)
        else:
            to = f(*args, **kwargs)
            while True:
                if type(to) is GeneratorType:
                    stack.append(to)
                    to = next(to)
                else:
                    stack.pop()
                    if not stack:
                        break
                    to = stack[-1].send(to)
            return to
    return wrappedfunc

def get_adj_mat(src, dst):
    matrix = defaultdict(list)
    for src_i, dst_i in zip(src, dst):
        matrix[src_i].append(dst_i)
        matrix[dst_i].append(src_i)
    return matrix


@bootstrap
def set_nodes_status(node, good, seen, adj_mat, vals):
    all_values_same, all_childs_good = True, True

    for child in adj_mat[node]:
        if not seen[child]:
            seen[child] = True
            all_values_same = all_values_same and vals[child] == vals[node]
            yield set_nodes_status(child, good, seen, adj_mat, vals)
            all_childs_good = all_childs_good and good[child]
    good[node] = all_values_same and all_childs_good
    yield None

def find_bad_child(node, good, adj_mat, vals):
    bad_childs = []
    not_same_good_childs = []
    num_childs = 0
    for child in adj_mat[node]:
        num_childs += 1
        if good[child]:
            if not vals[node] == vals[child]:
                not_same_good_childs.append(child)
        else:
            bad_childs.append(child)
    good[node] = True
    
    if len(bad_childs) > 1:
        return -1
    elif len(bad_childs) == 1:
        if len(not_same_good_childs) > 0:
            return -1
        else:
            return bad_childs[0]
    else:
        return node


def walk(node, good, adj_mat, vals):
    
    while True:
        cand = find_bad_child(node, good, adj_mat, vals)
        if cand == -1:
            print("NO")
            return
        elif cand == node:
            print("YES")
            print(cand+1)
            return
        else:
            node = cand

        

def solve(src ,dst, vals):
    n = len(vals)
    adj_mat = get_adj_mat(src, dst)
    seen = [False] * n
    good = [False] * n
    root = 1
    seen[root] = True
    set_nodes_status(root, good, seen, adj_mat, vals)
    walk(root, good, adj_mat, vals)

        
if __name__ == "__main__":
    n = int(input())
    src, dst = [], []
    for _ in range(n-1):
        src_i, dst_i = [int(val) for val in input().split()]
        src.append(src_i-1), dst.append(dst_i-1)
    vals = [int(val) for val in input().split()]
    solve(src, dst, vals)

