#include <bits/stdc++.h>
const int P = 998244353;
const int B = 19;
const int N = 1 << B;
const int SZ = 202020;
using namespace std;
int n, q, dfso[SZ], lvl[SZ];
pair<int, int> etl[2 * N];
vector<int> g[SZ];
vector<pair<int, int> > c[SZ];
int fe[SZ];
int te = 0;
void dfs(int i, int l) {
  lvl[i] = l;
  dfso[i] = ++te;
  etl[te + N] = {l, i};
  for (int j : g[i]) {
    if (!lvl[j]) {
      dfs(j, l + 1);
      te++;
      etl[te + N] = {l, i};
    }
  }
}
void mklca() {
  for (int i = 1; i < 2 * N; i++) etl[i] = {1e9, 1e9};
  dfs(1, 1);
  for (int i = N - 1; i > 0; i--) etl[i] = min(etl[2 * i], etl[2 * i + 1]);
}
int glca(int a, int b) {
  a = dfso[a] + N;
  b = dfso[b] + N;
  if (a > b) swap(a, b);
  pair<int, int> x = etl[a];
  while (a <= b) {
    if (a & 1) x = min(x, etl[a++]);
    if (~b & 1) x = min(x, etl[b--]);
    a /= 2;
    b /= 2;
  }
  return x.second;
}
bool cmp(int &a, int &b) { return dfso[a] < dfso[b]; }
vector<int> vtx;
vector<pair<int, int> > edg;
void insubt(vector<int> &nds) {
  sort(nds.begin(), nds.end(), cmp);
  vtx = nds;
  int nz = nds.size();
  vector<int> adj(nz), plca(nz);
  adj[0] = -1;
  for (int i = 1; i < nz; i++) {
    plca[i] = glca(nds[i - 1], nds[i]);
    adj[i] = i - 1;
  }
  int po = 1;
  for (int i = 0; i < nz - 2; i++) {
    while (po + 1 < nz && lvl[plca[po]] < lvl[plca[po + 1]]) po++;
    int nlca = glca(nds[po], nds[adj[po]]);
    bool k1 = (nds[po] != nlca), k2 = (nds[adj[po]] != nlca);
    if (k1) edg.push_back({nlca, nds[po]});
    if (k2) edg.push_back({nlca, nds[adj[po]]});
    if (k1 && k2) vtx.push_back(nlca);
    nds[po] = nlca;
    adj[po] = adj[adj[po]];
    if (adj[po] >= 0) plca[po] = glca(nds[po], nds[adj[po]]);
    if (po + 1 < nz) plca[po + 1] = glca(nds[po], nds[po + 1]);
    if (adj[po] < 0) po++;
  }
  if (nz > 1) edg.push_back({nds[po], nds[adj[po]]});
}
int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cin >> n;
  for (int i = 1; i < n; i++) {
    int x, y;
    cin >> x >> y;
    g[x].push_back(y);
    g[y].push_back(x);
  }
  mklca();
  cin >> q;
  for (; q--;) {
    int k, m;
    cin >> k >> m;
    vector<int> imp(m), dc;
    vector<pair<int, int> > vr(k);
    for (int i = 0; i < k; i++) {
      cin >> vr[i].first >> vr[i].second;
      dc.push_back(vr[i].first);
    }
    for (int i = 0; i < m; i++) {
      cin >> imp[i];
      dc.push_back(imp[i]);
    }
    edg.clear();
    insubt(dc);
    for (pair<int, int> p : edg) {
      int dist =
          lvl[p.first] + lvl[p.second] - 2 * lvl[glca(p.first, p.second)];
      c[p.first].push_back({p.second, dist});
      c[p.second].push_back({p.first, dist});
    }
    priority_queue<pair<pair<int, int>, pair<int, int> > > qd;
    for (int i = 0; i < k; i++) {
      fe[vr[i].first] = i + 1;
      qd.push({{0, -i}, {vr[i].second, vr[i].first}});
    }
    while (!qd.empty()) {
      pair<pair<int, int>, pair<int, int> > cr = qd.top();
      qd.pop();
      cr.first.second = -cr.first.second;
      if (fe[cr.second.second] && fe[cr.second.second] != cr.first.second + 1)
        continue;
      fe[cr.second.second] = cr.first.second + 1;
      for (pair<int, int> j : c[cr.second.second]) {
        if (!fe[j.first]) {
          pair<pair<int, int>, pair<int, int> > nx = cr;
          nx.second.first -= j.second;
          if (nx.second.first < 0) {
            long long k = 0;
            for (long long b = 1 << 18; b > 0; b /= 2) {
              if ((long long)nx.second.first +
                      (k + b) * (long long)vr[cr.first.second].second <
                  0)
                k += b;
            }
            k++;
            nx.second.first += k * vr[cr.first.second].second;
            nx.first.first -= k;
          }
          nx.first.second = -nx.first.second;
          nx.second.second = j.first;
          qd.push(nx);
        }
      }
    }
    for (int i : imp) cout << fe[i] << ' ';
    cout << '\n';
    for (int i : vtx) {
      c[i].clear();
      fe[i] = 0;
    }
  }
  return 0;
}
