#include <bits/stdc++.h>
using namespace std;
template <typename T>
void print(T&& x) {
  cout << x << "\n";
}
template <typename T, typename... S>
void print(T&& x, S&&... y) {
  cout << x << ' ';
  print(y...);
}
const long long Mod = 1000000007, Mod2 = 998244353;
const long long MOD = Mod2;
const long long maxn = 200005;
long long n, u, v, cur, dep[maxn], id[maxn], fa[maxn][18], q, k, m, x, s[maxn];
vector<long long> adj[maxn], adj2[maxn], vec, vec1, vec2, vec3;
pair<long long, long long> dis[maxn];
bool vis[maxn];
void dfs(long long u, long long par) {
  dep[u] = ~par ? dep[par] + 1 : 0;
  id[u] = cur++;
  fa[u][0] = par;
  for (long long i = (1); i < ((long long)(18)); i++)
    fa[u][i] = ~fa[u][i - 1] ? fa[fa[u][i - 1]][i - 1] : -1;
  for (auto v : adj[u])
    if (v != par) {
      dfs(v, u);
    }
}
long long lca(long long u, long long v) {
  if (dep[u] > dep[v]) swap(u, v);
  for (long long i = (0); i < ((long long)(18)); i++)
    if ((dep[v] - dep[u]) & (1ll << (i))) v = fa[v][i];
  if (u == v) return u;
  for (long long i = (17); i >= ((long long)(0)); i--)
    if (fa[u][i] != fa[v][i]) u = fa[u][i], v = fa[v][i];
  return fa[u][0];
}
void build(vector<long long> vec, vector<long long>& vec2) {
  if (none_of(vec.begin(), vec.end(), [](long long i) { return !i; }))
    vec.push_back(0);
  sort(vec.begin(), vec.end(),
       [](long long i, long long j) { return id[i] < id[j]; });
  vector<long long> sk;
  vec2.clear();
  for (auto u : vec) {
    if (sk.empty()) {
      sk.push_back(u);
      adj2[u].clear();
      vec2.push_back(u);
      continue;
    }
    long long v = lca(sk.back(), u);
    if (v == sk.back()) {
      sk.push_back(u);
      adj2[u].clear();
      vec2.push_back(u);
      continue;
    }
    while (((long long)sk.size()) >= 2 &&
           dep[sk[((long long)sk.size()) - 2]] >= dep[v]) {
      adj2[sk.back()].push_back(sk[((long long)sk.size()) - 2]);
      adj2[sk[((long long)sk.size()) - 2]].push_back(sk.back());
      sk.pop_back();
    }
    if (((long long)sk.size()) >= 1 && sk.back() != v) {
      adj2[v].clear();
      adj2[sk.back()].push_back(v);
      adj2[v].push_back(sk.back());
      sk.pop_back();
      sk.push_back(v);
      vec2.push_back(v);
    }
    sk.push_back(u);
    adj2[u].clear();
    vec2.push_back(u);
  }
  for (long long i = (0); i < ((long long)(((long long)sk.size()) - 1)); i++) {
    adj2[sk[i]].push_back(sk[i + 1]);
    adj2[sk[i + 1]].push_back(sk[i]);
  }
}
struct cmp {
  bool operator()(const pair<pair<long long, long long>, long long>& i,
                  const pair<pair<long long, long long>, long long>& j) const {
    return (((i.first.first) + (s[i.first.second]) - 1) /
            (s[i.first.second])) ==
                   (((j.first.first) + (s[j.first.second]) - 1) /
                    (s[j.first.second]))
               ? i.first.second > j.first.second
               : (((i.first.first) + (s[i.first.second]) - 1) /
                  (s[i.first.second])) >
                     (((j.first.first) + (s[j.first.second]) - 1) /
                      (s[j.first.second]));
  }
};
priority_queue<pair<pair<long long, long long>, long long>,
               vector<pair<pair<long long, long long>, long long>>, cmp>
    pq;
signed main() {
  ios_base::sync_with_stdio(0), cin.tie(0);
  cin >> n;
  for (long long i = (0); i < ((long long)(n - 1)); i++) {
    cin >> u >> v;
    u--, v--;
    adj[u].push_back(v), adj[v].push_back(u);
  }
  dfs(0, -1);
  cin >> q;
  while (q--) {
    cin >> k >> m;
    vec1.resize(k), vec2.resize(m);
    for (long long i = (0); i < ((long long)(((long long)vec1.size()))); i++) {
      cin >> vec1[i] >> s[i];
      vec1[i]--;
    }
    for (auto& i : vec2) cin >> i;
    for (auto& i : vec2) i--;
    vec3.clear();
    for (auto& i : vec1) vec3.push_back(i);
    for (auto& i : vec2) vec3.push_back(i);
    build(vec3, vec);
    for (auto& i : vec) dis[i] = {4000000000000000000, 0}, vis[i] = false;
    for (long long i = (0); i < ((long long)(((long long)vec1.size()))); i++)
      dis[vec1[i]] = {0, i};
    for (long long i = (0); i < ((long long)(((long long)vec1.size()))); i++)
      pq.push(make_pair(dis[vec1[i]], vec1[i]));
    while (!pq.empty()) {
      u = pq.top().second;
      pair<long long, long long> p = pq.top().first;
      pq.pop();
      if (vis[u]) continue;
      vis[u] = true;
      dis[u] = p;
      for (auto v : adj2[u])
        pq.push({{p.first + abs(dep[u] - dep[v]), p.second}, v});
    }
    for (auto& i : vec2) cout << (dis[i].second + 1) << ' ';
    cout << "\n";
  }
  return 0;
}
