#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 5;
const int mlog = 19;
const int inf = 1e9;
int n, m, k, q;
vector<int> way[maxn];
int h[maxn], par[maxn][25];
int cur, st[maxn];
int virus[maxn], spread[maxn];
int city[maxn];
vector<int> vir;
int stk[maxn];
vector<pair<int, int> > edge[maxn];
struct cost {
  int len, id;
  cost(int _len = 0, int _id = 0) {
    len = _len;
    id = _id;
  }
  int step() { return (int)ceil((double)len / spread[id]); }
  bool operator<(cost a) {
    if (a.step() != step()) return step() < a.step();
    return id < a.id;
  }
};
struct node {
  int u;
  cost val;
  node(int _u = 0, cost _val = cost(inf, 0)) {
    u = _u;
    val = _val;
  }
  bool operator<(node a) const { return a.val < val; }
};
cost ans[maxn];
void dfs(int u, int last) {
  st[u] = ++cur;
  h[u] = h[last] + 1;
  par[u][0] = last;
  for (int i = 1; i <= mlog; i++) par[u][i] = par[par[u][i - 1]][i - 1];
  for (auto v : way[u])
    if (v != last) dfs(v, u);
}
int lca(int x, int y) {
  if (h[x] <= h[y]) swap(x, y);
  for (int i = mlog; i >= 0; i--)
    if (h[par[x][i]] >= h[y]) x = par[x][i];
  if (x == y) return x;
  for (int i = mlog; i >= 0; i--)
    if (par[x][i] != par[y][i]) x = par[x][i], y = par[y][i];
  return par[x][0];
}
void add_edge(int x, int y) {
  int len = h[x] + h[y] - 2 * h[lca(x, y)];
  edge[x].push_back({y, len});
  edge[y].push_back({x, len});
}
void build(vector<int> vec) {
  for (auto u : vir) edge[u].clear();
  vir = vec;
  sort(vec.begin(), vec.end(), [](int u, int v) { return st[u] < st[v]; });
  int sz = 0;
  stk[++sz] = 1;
  for (auto u : vec) {
    int x = lca(u, stk[sz]);
    vir.push_back(x);
    if (x != stk[sz]) {
      while (sz >= 2 && h[stk[sz - 1]] >= h[x]) {
        add_edge(stk[sz - 1], stk[sz]);
        sz--;
      }
      if (x != stk[sz]) {
        add_edge(x, stk[sz]);
        stk[sz] = x;
      }
    }
    if (u != stk[sz]) stk[++sz] = u;
  }
  for (int i = 1; i <= sz - 1; i++) add_edge(stk[i], stk[i + 1]);
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n - 1; i++) {
    int u, v;
    scanf("%d%d", &u, &v);
    way[u].push_back(v);
    way[v].push_back(u);
  }
  dfs(1, 0);
  scanf("%d", &q);
  while (q--) {
    scanf("%d%d", &k, &m);
    vector<int> vec;
    for (int i = 1; i <= k; i++) {
      int u, val;
      scanf("%d%d", &u, &val);
      virus[i] = u;
      spread[i] = val;
      vec.push_back(u);
    }
    for (int i = 1; i <= m; i++) {
      int u;
      scanf("%d", &u);
      city[i] = u;
      vec.push_back(u);
    }
    sort(vec.begin(), vec.end());
    vec.erase(unique(vec.begin(), vec.end()), vec.end());
    build(vec);
    spread[0] = 1;
    for (auto x : vir) ans[x] = cost(inf, 0);
    priority_queue<node> heap;
    for (int i = 1; i <= k; i++) {
      int u = virus[i];
      ans[u] = {0, i};
      heap.push(node(u, ans[u]));
    }
    while (!heap.empty()) {
      auto tmp = heap.top();
      heap.pop();
      int u = tmp.u;
      cost val = tmp.val;
      if (ans[u] < val) continue;
      for (auto t : edge[u]) {
        int v = t.first, len = t.second;
        cost nxt = cost(val.len + len, val.id);
        if (nxt < ans[v]) {
          ans[v] = nxt;
          heap.push(node(v, ans[v]));
        }
      }
    }
    for (int i = 1; i <= m; i++) printf("%d ", ans[city[i]].id);
    printf("\n");
  }
}
