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 bisect import bisect_left,bisect_right
from collections import defaultdict as dd
from collections import deque, Counter
from heapq import heappop,heappush,heapify,merge
from itertools import permutations, accumulate, product
from math import gcd,sqrt,ceil
toBin=lambda x:bin(x).replace("0b","")
inf=float("inf");DIRS=[[1,0],[-1,0],[0,1],[0,-1]];CHARS="abcdefghijklmnopqrstuvwxyz";MOD=10**9+7
###### Fill out N to calculate combinations#####################
# N=300010;fac=[1]*N;invfac=[1]*N
# for i in range(2,N):fac[i]=fac[i-1]*i%MOD
# invfac[N-1]=pow(fac[N-1],MOD-2,MOD)
# for i in range(N-1)[::-1]:invfac[i]=invfac[i+1]*(i+1)%MOD
# def c(i,j):return 0 if i<j else fac[i]*invfac[j]*invfac[i-j]
###############################################################
input=sys.stdin.readline

class UnionFind:
    def __init__(self,n):self.p=list(range(n));self.rank=[1]*n
    def find(self,x):
        if x!=self.p[x]:self.p[x]=self.find(self.p[x])
        return self.p[x]
    def union(self,x, y):
        px,py=self.find(x),self.find(y)
        if px==py:return 0
        self.p[py]=px
        return 1

from types import GeneratorType
def cache(f,queue=[]):
    def wrappedfunc(*args,**kwargs):
        if queue:return f(*args, **kwargs)
        else:
            to = f(*args,**kwargs)
            while True:
                if isinstance(to,GeneratorType):queue.append(to);to = next(to)
                else:
                    if not queue:break
                    queue.pop()
                    if not queue:break
                    to=queue[-1].send(to)
            return to
    return wrappedfunc

def query(x,y):
    print("?",x,y,flush=True)
    return int(input())

sys.setrecursionlimit(200000)

# DP,BS,Greedy,Graph
def solve():
    """
    5 min to fully understand.so we are only considering the direct children of the root.
    If a tree has more than 3 different colors, its always a no... (not true) 10m.
    If a tree has 2 different colors that are far away, its a no unless they are placed
    as children.
    what matters is the number of in degrees in a node. Nodes with 0 in degrees
    can be of any color since they are leaves. 12m.
    if nodes are not direct children of root and they aren't leaves, and they have
    different colors, its a no. can't just keep track of colors to nodes since we
    dont know the relationship between them...maybe there is a way to root at a leaf
    and then...check different roots but somehow know its orientations..?
    21m - if par and child are different color, one of the has to be the root.
    R-B-B-R-B. If par and child are different >2, always a no. if its 2, only if they
    are connected, else its always a no. we can keep track of their connections.
    can only have 1-2-1 or 1 1.
    """
    n=int(input());G={i:set() for i in range(1,n+1)};ok=True
    for _ in range(n-1):
        u,v=map(int,input().split())
        G[u].add(v);G[v].add(u)
    C=list(map(int,input().split()));A=[0]*n;vis=set()
    for u in range(1,n+1):
        for v in G[u]:
            if (u,v) in vis:continue
            vis.add((u,v));vis.add((v,u))
            if C[u-1]!=C[v-1]:A[v-1]+=1;A[u-1]+=1;print(u,v)
    ones=2;twos=1;twoi=-1
    for i,a in enumerate(A):
        if a>2:ok=False;break;
        if a==1:ones-=1
        if a==2:twos-=1;twoi=i+1
    # print(A,G)
    if ((ones==0 and twos==1) or (ones==0 and twos==0)):print("YES");print(twoi)
    else:print("NO")

if __name__=="__main__":
    solve()
