#include using namespace std; int main () { int N; cin >> N; std::vector tr[200020] ; for (int i = 1; i < N; i ++) { int a, b; cin >> a >> b; tr[--a].push_back(--b); tr[b].push_back(a); } vector ex(N, 0); vector ne_h(N, 0); int M; cin >> M; for (int i = 0; i < M; i ++) { int a; cin >> a; ex[--a] = 1; for (auto v : tr[a]) { ne_h[v] = 1; } ne_h[a] = 1; } int sssu = accumulate(ne_h.begin(), ne_h.end(), 0); vector ans(N, sssu); for (int i = 0; i < N; i ++) { if (!ne_h[i]) continue; ans[i] --; int fl = -1; for (auto v : tr[i]) { if (ex[v]) { if (fl != -1) { fl = -2; } else { fl = v; } } } if (fl >= 0) { ans[fl] --; if (!ex[i]) { for (auto v : tr[fl]) { if (v != i) { ans[v] --; } } } } } for (auto a : ans) { cout << a << endl; } }