#include <bits/stdc++.h>
using namespace std;
template <class t>
inline t read(t &x) {
  char c = getchar();
  bool f = 0;
  x = 0;
  while (!isdigit(c)) f |= c == '-', c = getchar();
  while (isdigit(c)) x = (x << 1) + (x << 3) + (c ^ 48), c = getchar();
  if (f) x = -x;
  return x;
}
template <class t>
inline void write(t x) {
  if (x < 0)
    putchar('-'), write(-x);
  else {
    if (x > 9) write(x / 10);
    putchar('0' + x % 10);
  }
}
const int N = 4e5 + 5;
int idn, dfn[N], d[N], st[N], top, p[N], m, n, a[N], b[N], sp[N];
bool v[N];
vector<int> g[N], G[N], bin;
namespace rmq {
int a[N], f[N][20], p[N], lg[N];
void dfs(int x, int fa) {
  d[x] = d[fa] + 1;
  dfn[x] = ++idn;
  a[p[x] = ++*a] = x;
  for (int y : g[x])
    if (y ^ fa) dfs(y, x), a[++*a] = x;
}
void init() {
  for (int i = 2; i <= n << 1; i++) lg[i] = lg[i >> 1] + 1;
  dfs(1, 0);
  for (int i = 1; i <= *a; i++) f[i][0] = a[i];
  for (int j = 1; j <= 19; j++)
    for (int i = 1; i + (1 << j) - 1 <= *a; i++) {
      if (d[f[i][j - 1]] < d[f[i + (1 << j - 1)][j - 1]])
        f[i][j] = f[i][j - 1];
      else
        f[i][j] = f[i + (1 << j - 1)][j - 1];
    }
}
int lca(int x, int y) {
  int l = p[x], r = p[y];
  if (l > r) swap(l, r);
  int k = lg[r - l + 1];
  return d[f[l][k]] <= d[f[r - (1 << k) + 1][k]] ? f[l][k]
                                                 : f[r - (1 << k) + 1][k];
}
}  // namespace rmq
struct node {
  int dis, rd, col, sp;
  inline bool operator<(const node &nt) const {
    return rd == nt.rd ? col < nt.col : rd < nt.rd;
  }
} dis[N];
priority_queue<pair<node, int>, vector<pair<node, int>>,
               greater<pair<node, int>>>
    q;
int abs(int x) { return x >= 0 ? x : -x; }
void dij() {
  for (int x : bin) {
    dis[x] = {0x3f3f3f3f, 0x3f3f3f3f, 0, 0};
    v[x] = 0;
  }
  for (int i = 1; i <= *a; i++) {
    dis[a[i]] = {0, 0, i, sp[i]};
    q.push({dis[a[i]], a[i]});
  }
  while (!q.empty()) {
    int x = q.top().second;
    q.pop();
    if (v[x]) continue;
    v[x] = 1;
    for (int y : G[x]) {
      auto nxt = dis[x];
      nxt.dis += abs(d[x] - d[y]);
      nxt.rd = (nxt.dis - 1) / nxt.sp + 1;
      if (nxt < dis[y]) {
        dis[y] = nxt;
        q.push({dis[y], y});
      }
    }
  }
}
void build(int x) {
  if (!top) return st[++top] = x, void();
  int lca = rmq::lca(st[top], x);
  while (top > 1 && d[lca] < d[st[top - 1]])
    G[st[top - 1]].push_back(st[top]), G[st[top]].push_back(st[top - 1]), top--;
  if (d[lca] < d[st[top]])
    G[lca].push_back(st[top]), G[st[top]].push_back(lca), top--;
  if (!top || st[top] != lca) st[++top] = lca;
  st[++top] = x;
}
void reset(int x, int fa) {
  bin.push_back(x);
  for (int y : G[x])
    if (y ^ fa) reset(y, x);
}
void doit() {
  top = m = 0;
  bin.clear();
  read(*a);
  read(*b);
  for (int i = 1; i <= *a; i++) read(a[i]), p[++m] = a[i], read(sp[i]);
  for (int i = 1; i <= *b; i++) read(b[i]), p[++m] = b[i];
  sort(p + 1, p + 1 + m, [](int x, int y) { return dfn[x] < dfn[y]; });
  m = unique(p + 1, p + 1 + m) - p - 1;
  for (int i = 1; i <= m; i++) build(p[i]);
  while (top > 1)
    G[st[top]].push_back(st[top - 1]), G[st[top - 1]].push_back(st[top]), top--;
  reset(st[1], 0);
  dij();
  for (int i = 1; i <= *b; i++) write(dis[b[i]].col), putchar(' ');
  puts("");
  for (int x : bin) G[x].clear();
}
signed main() {
  read(n);
  for (int i = 1, x, y; i < n; i++) {
    read(x);
    read(y);
    g[x].push_back(y);
    g[y].push_back(x);
  }
  rmq::init();
  int t;
  read(t);
  while (t--) doit();
}
