#include <bits/stdc++.h>
#define se second
#define fi first
#define pb push_back
#define get_bit(mask,j) (mask>>j)&1
using namespace std;
using ll = long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
const int maxn = 2e6+5;
const int mod = 1e9+7;
const ll inf = 1e18;

void read()
{
    #define name "colorful"
    cin.tie(0)->ios_base::sync_with_stdio(0);cout.tie(0);
    if(fopen(name".INP","r")){
        freopen(name".INP","r",stdin);
        freopen(name".OUT","w",stdout);
    }
}

int deg[maxn],color[maxn];
vector<int> adj[maxn];

void solve()
{
	int n;
	cin >> n;
	for(int i = 1,u,v; i < n; i++){
		cin >> u >> v;
		adj[u].pb(v);
		adj[v].pb(u);
	}
	for(int i = 1; i <= n; i++){
		cin >> color[i];
	}
	int remove = 0;
	for(int i = 1; i <= n; i++){
		for(auto &v : adj[i]){
			if(color[i] != color[v]){
				deg[i]++;
				deg[v]++;
				remove++;
			}
		}
	}
	vector<int> res;
	for(int i = 1; i <= n; i++){
		if(deg[i] == remove) res.pb(i);
	}
	if(res.empty()) cout << "NO";
	else{
		sort(res.begin(),res.end());
		cout << "YES\n";
		for(auto &x : res) cout << x << " ";
	}
}

signed main()
{
    read();
    int subtask;
    cin >> subtask;
    solve();
    return 0;
}