#include <bits/stdc++.h>
const int B = 2 << 20;
struct streambufcin {
  std::streambuf *in;
  streambufcin() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(NULL);
    in = std::cin.rdbuf();
    bg = ed = NULL;
  }
  char buf[B], *bg, *ed, ch;
  char gc() {
    return bg == ed ? ed = buf + in->sgetn(bg = buf, B),
                      (bg == ed ? -1 : *bg++) : *bg++;
  }
  template <class T>
  streambufcin &operator>>(T &x) {
    bool neg = false;
    for (ch = gc(); !isdigit(ch); ch = gc())
      ;
    if (ch == '-') neg = true;
    for (x = 0; isdigit(ch); ch = gc()) x = x * 10 + ch - 48;
    if (neg) x = -x;
    return *this;
  }
  streambufcin &operator>>(char &c) {
    for (c = gc(); isspace(c); c = gc())
      ;
    return *this;
  }
} cin;
struct streambufcout {
  std::streambuf *out = std::cout.rdbuf();
  char buf[B], *optr = buf;
  streambufcout() { out = std::cout.rdbuf(); }
  ~streambufcout() { flush(); }
  void flush() {
    out->sputn(buf, optr - buf);
    optr = buf;
  }
  void pc(char c) {
    if (optr == buf + B) flush();
    *optr++ = c;
  }
  template <class T>
  streambufcout &operator<<(T x) {
    static int st[233], top;
    if (x < 0) {
      x = -x;
      pc('-');
    }
    do {
      st[++top] = x % 10;
      x /= 10;
    } while (x);
    while (top) pc(st[top--] ^ 48);
    return *this;
  }
  streambufcout &operator<<(char c) {
    pc(c);
    return *this;
  }
} cout;
int n;
const int N = 200001;
const int K = 18;
struct edge {
  int v, nxt;
} e[N << 1];
int head[N], cnt;
void add(int u, int v) {
  e[++cnt] = {v, head[u]}, head[u] = cnt;
  e[++cnt] = {u, head[v]}, head[v] = cnt;
}
int par[N][K], dep[N], dfn[N], Index;
void dfs(int u, int father) {
  *par[u] = father;
  dep[u] = dep[father] + 1;
  dfn[u] = ++Index;
  for (int i = head[u]; i; i = e[i].nxt) {
    int v = e[i].v;
    if (v != father) dfs(v, u);
  }
}
int lca(int x, int y) {
  if (dep[x] < dep[y]) std::swap(x, y);
  for (int i = K - 1; ~i; --i)
    if (dep[par[x][i]] >= dep[y]) x = par[x][i];
  if (x == y) return x;
  for (int i = K - 1; ~i; --i)
    if (par[x][i] != par[y][i]) x = par[x][i], y = par[y][i];
  return par[x][0];
}
int getdis(int x, int y) { return dep[x] + dep[y] - 2 * dep[lca(x, y)]; }
struct Condition {
  int col, speed, di, time;
  bool operator<(const Condition &rhs) const {
    if (time != rhs.time) return time < rhs.time;
    if (col != rhs.col) return col < rhs.col;
    return di > rhs.di;
  }
} condition[N], initial;
int query[N];
struct Node {
  Condition p;
  int x;
  bool operator<(const Node &rhs) const { return rhs.p < p; }
};
int a[N * 2], tot;
bool cmp(int x, int y) { return dfn[x] < dfn[y]; }
std::vector<int> g[N];
void adde(int x, int y) {
  g[x].push_back(y);
  g[y].push_back(x);
}
int st[N * 2], top;
void insert(int x) {
  if (top == 1) {
    st[++top] = x;
    return;
  }
  int _lca = lca(x, st[top]);
  if (_lca == st[top]) {
    st[++top] = x;
    return;
  }
  while (top > 1 && dfn[st[top - 1]] >= dfn[_lca]) {
    adde(st[top], st[top - 1]);
    --top;
  }
  if (_lca != st[top]) {
    adde(st[top], _lca);
    st[top] = _lca;
  }
  st[++top] = x;
}
void build_tree() {
  std::sort(a + 1, a + tot + 1, cmp);
  st[top = 1] = a[0] = 1;
  for (int i = 1; i <= tot; i++) {
    if (a[i] == a[i - 1]) continue;
    insert(a[i]);
  }
  while (top > 0) {
    adde(st[top], st[top - 1]);
    --top;
  }
}
bool Cmp(Condition a, Node b) { return a < b.p; }
std::priority_queue<Node> q;
Condition To(int u, int v) {
  int dis = getdis(u, v);
  Condition now = condition[u];
  if (dis <= condition[u].di) {
    now.di -= dis;
    return now;
  }
  dis -= condition[u].di;
  int t = (dis - 1) / condition[u].speed + 1;
  now.di = t * condition[u].speed - dis;
  now.time += t;
  return now;
}
void dij() {
  while (!q.empty()) {
    Node u = q.top();
    q.pop();
    if (Cmp(condition[u.x], u)) continue;
    for (auto v : g[u.x]) {
      Condition nxt = To(u.x, v);
      if (nxt < condition[v]) {
        condition[v] = nxt;
        q.push({condition[v], v});
      }
    }
  }
}
void clear(int u, int father) {
  for (auto v : g[u]) {
    if (v != father) clear(v, u);
  }
  g[u].clear();
  condition[u] = initial;
}
void solve() {
  int m, k;
  cin >> m >> k;
  for (int i = 1; i <= m; i++) {
    int v;
    cin >> a[i] >> v;
    condition[a[i]].col = i;
    condition[a[i]].speed = v;
    condition[a[i]].time = 0;
    q.push({condition[a[i]], a[i]});
  }
  tot = m;
  for (int i = 1; i <= k; i++) {
    cin >> query[i];
    a[++tot] = query[i];
  }
  build_tree();
  dij();
  for (int i = 1; i <= k; i++) cout << condition[query[i]].col << ' ';
  cout << '\n';
  clear(1, 0);
}
int main() {
  cin >> n;
  for (int i = 1; i < n; i++) {
    int x, y;
    cin >> x >> y;
    add(x, y);
  }
  dfs(1, 0);
  for (int j = 1; j < K; j++)
    for (int i = 1; i <= n; i++) par[i][j] = par[par[i][j - 1]][j - 1];
  initial.col = n + 1;
  initial.time = n + 1;
  for (int i = 1; i <= n; i++) condition[i] = initial;
  int test;
  cin >> test;
  while (test--) solve();
  return 0;
}
