#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
int n, q, l[N], r[N], level[N], p[N][20], res[N];
int import[N], numCity, numVirus;
vector<int> adj[N];
vector<pair<int, int> > newAdj[N];
struct T {
  int city, speed;
};
T virus[N];
pair<pair<int, int>, int> top;
struct Less {
  bool operator()(const pair<pair<int, int>, int>& x,
                  const pair<pair<int, int>, int>& y) {
    int a = x.first.first / virus[x.first.second].speed,
        b = y.first.first / virus[y.first.second].speed;
    if (a != b) return a > b;
    return x.first.second > y.first.second;
  }
};
priority_queue<pair<pair<int, int>, int>, vector<pair<pair<int, int>, int> >,
               Less>
    pq;
int T;
void dfs(int u) {
  for (int i = 1; i <= 18; i++) p[u][i] = p[p[u][i - 1]][i - 1];
  l[u] = ++T;
  for (int v : adj[u]) {
    if (v == p[u][0]) continue;
    level[v] = level[u] + 1;
    p[v][0] = u;
    dfs(v);
  }
  r[u] = T;
}
int lca(int u, int v) {
  if (level[u] < level[v]) swap(u, v);
  for (int i = 18; i >= 0; --i)
    if (level[u] - (1 << i) >= level[v]) u = p[u][i];
  if (u == v) return u;
  for (int i = 18; i >= 0; --i)
    if (p[u][i] != p[v][i]) u = p[u][i], v = p[v][i];
  return p[u][0];
}
int dist(int x, int y) { return level[x] + level[y] - 2 * level[lca(x, y)]; }
vector<pair<int, int> > all;
void compress_tree() {
  all.clear();
  for (int i = 1; i <= numVirus; i++)
    all.push_back(make_pair(l[virus[i].city], virus[i].city));
  for (int i = 1; i <= numCity; i++)
    all.push_back(make_pair(l[import[i]], import[i]));
  sort(all.begin(), all.end());
  all.erase(unique(all.begin(), all.end()), all.end());
  int sz = all.size();
  for (int i = 1; i < sz; i++) {
    int p = lca(all[i].second, all[i - 1].second);
    all.push_back(make_pair(l[p], p));
  }
  sort(all.begin(), all.end());
  all.erase(unique(all.begin(), all.end()), all.end());
  vector<int> st;
  for (auto& u : all) {
    newAdj[u.second].clear();
    while (st.size() && r[st.back()] < u.first) st.pop_back();
    if (st.size()) {
      int dist = level[u.second] - level[st.back()];
      newAdj[st.back()].push_back(make_pair(u.second, dist));
      newAdj[u.second].push_back(make_pair(st.back(), dist));
    }
    st.push_back(u.second);
  }
}
void solve() {
  for (auto& x : all) res[x.second] = -1;
  for (int i = 1; i <= numVirus; i++)
    pq.push({{virus[i].speed - 1, i}, virus[i].city});
  while (pq.size()) {
    top = pq.top();
    pq.pop();
    if (res[top.second] != -1) continue;
    res[top.second] = top.first.second;
    for (auto u : newAdj[top.second]) {
      if (res[u.first] != -1) continue;
      pq.push({{top.first.first + u.second, top.first.second}, u.first});
    }
  }
  for (int i = 1; i <= numCity; i++) cout << res[import[i]] << ' ';
  cout << '\n';
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cin >> n;
  for (int i = 1; i < n; i++) {
    int u, v;
    cin >> u >> v;
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  dfs(1);
  cin >> q;
  while (q--) {
    cin >> numVirus >> numCity;
    for (int i = 1; i <= numVirus; i++) cin >> virus[i].city >> virus[i].speed;
    for (int i = 1; i <= numCity; i++) cin >> import[i];
    compress_tree();
    solve();
  }
}
