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
# Code by B3D
# Love

from math import *
from collections import *
import io, os
import sys


# from temps import *
 
MOD = 998244353
# sys.setrecursionlimit(10**6)

def subinp():
    sys.stdin = open("input.txt", "r")
    sys.stdout = open("output.txt", "w")

def subinp_1():
    sys.stdin = open("input.txt", "r")
    sys.stdout = open("op2.txt", "w")

"""
pow2 = [1]
# print(log2(10 ** 9))
for i in range(29):
    pow2.append(pow2[-1] * 2)
"""
# input = sys.stdin.readline
 

class Point:
    def __init__(self, x, l1):
        self.x = x
        self.l1 = l1

    def __lt__(self, b):
        return self.l1[self.x] < self.l1[b.x]

    def getval(self):
        return self.x


inp    = lambda: int(input())
strin  = lambda: input().strip()
strl   = lambda: list(input().rstrip("\r\n"))
strlst = lambda: list(map(str, input().split()))
mult   = lambda: map(int,input().strip().split())
mulf   = lambda: map(float,input().strip().split())
lstin  = lambda: list(map(int,input().strip().split()))
 
flush  = lambda: stdout.flush()
stdpr  = lambda x: stdout.write(str(x))

# @lru_cache(maxsize = 128)

# print(pref)
# ac = [chr(i) for i in range(ord('a'), ord('z') + 1)]
     
# Power comes in response to a need, not a desire.

# n = int(input())
# n, k = map(int, input().split())
# s = input()
# l = list(map(int, input().split()))
# dp = [[-1 for i in range(n + 1)] for j in range(2)]

# def sieve(n):
#     if n < 9:
#         n = 10
#     l = [1] * (n + 1)
#     for i in range(2, int(n ** 0.5) + 1):
#         if l[i] == 1:
#             for j in range(i ** 2, n + 1, i):
#                 if j % i == 0:
#                     l[j] = 0
#     l[1] = 0
#     return l

# sve = sieve(2 * 10 ** 3 +7 )

def panda(n, arr):
    return

input = io.BytesIO(os.read(0,os.fstat(0).st_size)).readline

t = 1
# t = int(input())

for _ in range(t):
    n = inp()
    mp = defaultdict(int)
    edges = []
    for i in range(n - 1):
        edges.append(mult())
    cnt = 0
    arr = [-1] + lstin()

    for u, v in edges:
        if arr[u] != arr[v]:
            cnt += 1
            mp[u] += 1
            mp[v] += 1

    for i in range(1, n + 1):
        if mp[i] == cnt:
            print("YES")
            print(i)
            break
    else:
        print("NO")

    # print(ans)

    # a1 = redpanda(n, l)
    # print(a)
    # print(a1)
    # sys.stdout.write(str(ans))
    # print("Case #" + str(_ + 1) + ": " + str(ans))

