#include <bits/stdc++.h>
using namespace std;
const int maxn = 400003, INF = 0x3f3f3f3f;
int n, Q, dep[maxn], stk[maxn], top, st[maxn][19], ord[maxn], cntst, lg[maxn],
    p[maxn], a[maxn], b[maxn], c[maxn];
vector<int> h[maxn], g[maxn];
struct data {
  int t, i;
  data() {}
  data(int _t, int _i) : t(_t), i(_i) {}
  bool operator<(const data &x) const {
    int t1 = (t + b[i] - 1) / b[i], t2 = (x.t + b[x.i] - 1) / b[x.i];
    return t1 != t2 ? t1 < t2 : i < x.i;
  }
};
data dis[maxn];
priority_queue<pair<data, int>, vector<pair<data, int> >,
               greater<pair<data, int> > >
    q;
void addedge(int u, int v) { g[u].push_back(v), g[v].push_back(u); }
void init(int u, int last) {
  st[++cntst][0] = u;
  ord[u] = cntst;
  for (int v : h[u]) {
    if (v == last) continue;
    dep[v] = dep[u] + 1;
    init(v, u);
    st[++cntst][0] = u;
  }
}
int MIN(int x, int y) { return ord[x] < ord[y] ? x : y; }
void initst() {
  for (int l = 1; (1 << l) <= cntst; l++) {
    for (int i = 1; i + (1 << l) - 1 <= cntst; i++) {
      st[i][l] = MIN(st[i][l - 1], st[i + (1 << (l - 1))][l - 1]);
    }
  }
}
int lca(int x, int y) {
  int l = ord[x], r = ord[y];
  if (l > r) swap(l, r);
  int tmp = lg[r - l + 1];
  return MIN(st[l][tmp], st[r - (1 << tmp) + 1][tmp]);
}
bool cmp(int x, int y) { return ord[x] < ord[y]; }
void build(int p[], int &k) {
  sort(p + 1, p + k + 1, cmp);
  k = unique(p + 1, p + k + 1) - p - 1;
  top = 0;
  for (int i = 1; i <= k; i++) {
    int u = p[i];
    if (top >= 2) {
      int l = lca(u, stk[top]);
      if (l != stk[top]) {
        while (top >= 2 && ord[stk[top - 1]] >= ord[l])
          addedge(stk[top - 1], stk[top]), top--;
        if (stk[top] != l) addedge(l, stk[top]), stk[top] = l;
      }
    }
    stk[++top] = u;
  }
  while (top >= 2) addedge(stk[top - 1], stk[top]), top--;
}
void clear(int u, int last) {
  for (int v : g[u]) {
    if (v == last) continue;
    clear(v, u);
  }
  dis[u] = data(INF, 0), g[u].clear();
}
void dijkstra(int k) {
  while (!q.empty()) q.pop();
  for (int i = 1; i <= k; i++)
    q.push(pair<data, int>(dis[a[i]] = data(0, i), a[i]));
  while (!q.empty()) {
    data x = q.top().first;
    int u = q.top().second;
    q.pop();
    if (dis[u] < x) continue;
    for (int v : g[u]) {
      data w(dis[u].t + abs(dep[u] - dep[v]), dis[u].i);
      if (w < dis[v]) {
        dis[v] = w;
        q.push(pair<data, int>(dis[v], v));
      }
    }
  }
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i < n; i++) {
    int u, v;
    scanf("%d%d", &u, &v);
    h[u].push_back(v), h[v].push_back(u);
  }
  init(1, 0);
  for (int i = 2; i <= cntst; i++) lg[i] = lg[i >> 1] + 1;
  initst();
  fill(dis + 1, dis + n + 1, data(INF, 0));
  b[0] = 1;
  scanf("%d", &Q);
  while (Q--) {
    int k, m, tot = 0;
    scanf("%d%d", &k, &m);
    for (int i = 1; i <= k; i++) scanf("%d%d", a + i, b + i), p[++tot] = a[i];
    for (int i = 1; i <= m; i++) scanf("%d", c + i), p[++tot] = c[i];
    p[++tot] = 1;
    build(p, tot);
    dijkstra(k);
    for (int i = 1; i <= m; i++) printf("%d ", dis[c[i]].i);
    puts("");
    clear(1, 0);
  }
  return 0;
}
