#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;

    }


}