#include<bits/stdc++.h>
using namespace std;
const int maxn = 1e5;
vector<int> graph[maxn + 5];
bool special[maxn + 5];
int A[maxn + 5];
int res;
int parent[maxn + 5];
unordered_set<int> chalo;
void dfs(int u, int p, int col){
if(col == A[u])
special[u] = true;
if(special[u])
chalo.insert(u);
for (int i: graph[u]){
if(i == p) continue;
dfs(i, u, col);
}
}
void dfs1(int u, int p){
for (int i: graph[u]){
if(i == p) continue;
parent[i] = u;
dfs1(i, u);
}
}
int main(){
int n; cin >> n;
for (int i = 0, x,y; i < n-1; ++i){
cin >> x >> y;
graph[x].push_back(y);
graph[y].push_back(x);
}
for (int i = 1; i <= n; ++i)
cin >> A[i];
int q; cin >> q;
dfs1(1, -1);
while(q--){
int x; cin >> x;
int p = parent[x];
dfs(x, parent[x], A[x]);
cout << chalo.size() << endl;
}
}
I2luY2x1ZGU8Yml0cy9zdGRjKysuaD4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKY29uc3QgaW50IG1heG4gPSAxZTU7CnZlY3RvcjxpbnQ+IGdyYXBoW21heG4gKyA1XTsKYm9vbCBzcGVjaWFsW21heG4gKyA1XTsKaW50IEFbbWF4biArIDVdOwppbnQgcmVzOwppbnQgcGFyZW50W21heG4gKyA1XTsKdW5vcmRlcmVkX3NldDxpbnQ+IGNoYWxvOwoKdm9pZCBkZnMoaW50IHUsIGludCBwLCBpbnQgY29sKXsKICAgIGlmKGNvbCA9PSBBW3VdKQogICAgICAgIHNwZWNpYWxbdV0gPSB0cnVlOwogICAgaWYoc3BlY2lhbFt1XSkKICAgICAgICAgY2hhbG8uaW5zZXJ0KHUpOwogICAgZm9yIChpbnQgaTogZ3JhcGhbdV0pewogICAgICAgIGlmKGkgPT0gcCkgY29udGludWU7CiAgICAgICAgZGZzKGksIHUsIGNvbCk7CiAgICB9Cn0KCnZvaWQgZGZzMShpbnQgdSwgaW50IHApewogICAgZm9yIChpbnQgaTogZ3JhcGhbdV0pewogICAgICAgIGlmKGkgPT0gcCkgY29udGludWU7CiAgICAgICAgcGFyZW50W2ldID0gdTsKICAgICAgICBkZnMxKGksIHUpOwogICAgICAgIAogICAgfQp9CgppbnQgbWFpbigpewogICAgaW50IG47IGNpbiA+PiBuOyAKICAgIGZvciAoaW50IGkgPSAwLCB4LHk7IGkgPCBuLTE7ICsraSl7CiAgICAgICAgY2luID4+IHggPj4geTsKICAgICAgICBncmFwaFt4XS5wdXNoX2JhY2soeSk7CiAgICAgICAgZ3JhcGhbeV0ucHVzaF9iYWNrKHgpOwogICAgfQoKICAgIGZvciAoaW50IGkgPSAxOyBpIDw9IG47ICsraSkKICAgICAgICBjaW4gPj4gQVtpXTsKICAgIAogICAgaW50IHE7IGNpbiA+PiBxOwogICAgZGZzMSgxLCAtMSk7CiAgICAKICAgIHdoaWxlKHEtLSl7CiAgICAgICAgaW50IHg7IGNpbiA+PiB4OwogICAgICAgIGludCBwID0gcGFyZW50W3hdOwogICAgICAgIGRmcyh4LCBwYXJlbnRbeF0sIEFbeF0pOwogICAgICAgIGNvdXQgPDwgY2hhbG8uc2l6ZSgpIDw8IGVuZGw7CgogICAgfQoKCn0=