#include <bits/stdc++.h>
const int MAXN = 1e5 + 19;
struct Edge {
  int to, next;
} edge[MAXN << 1];
int head[MAXN], cnt;
inline void add(int from, int to) {
  edge[++cnt].to = to;
  edge[cnt].next = head[from];
  head[from] = cnt;
}
int dep[MAXN], top[MAXN], size[MAXN], son[MAXN], fa[MAXN], dfn[MAXN], ind;
void dfs1(int node, int f) {
  dep[node] = dep[f] + 1, size[node] = 1, fa[node] = f;
  for (int i = head[node]; i; i = edge[i].next)
    if (edge[i].to != f) {
      dfs1(edge[i].to, node);
      size[node] += size[edge[i].to];
      if (size[edge[i].to] > size[son[node]]) son[node] = edge[i].to;
    }
}
void dfs2(int node, int f, int t) {
  dfn[node] = ++ind, top[node] = t;
  if (son[node]) dfs2(son[node], node, t);
  for (int i = head[node]; i; i = edge[i].next)
    if (edge[i].to != f && edge[i].to != son[node])
      dfs2(edge[i].to, node, edge[i].to);
}
int lca(int x, int y) {
  while (top[x] != top[y])
    if (dep[top[x]] > dep[top[y]])
      x = fa[top[x]];
    else
      y = fa[top[y]];
  return dep[x] < dep[y] ? x : y;
}
int n, q;
int h[MAXN], k;
bool isKey[MAXN];
int st[MAXN], tp;
std::vector<int> G[MAXN];
int dp[MAXN][2];
void dfs(int node) {
  if (isKey[node]) {
    dp[node][1] = 0, dp[node][0] = n + 1;
    int tmp;
    for (int e : G[node]) {
      dfs(e);
      tmp = dp[e][0];
      if (dep[e] - dep[node] > 1) tmp = std::min(tmp, dp[e][1] + 1);
      dp[node][1] += tmp;
    }
  } else {
    for (int e : G[node]) dfs(e);
    int tmp = 0, mk = 0x3f3f3f3f;
    for (int e : G[node])
      tmp += dp[e][0], mk = std::min(mk, dp[e][1] - dp[e][0]);
    dp[node][0] = tmp;
    if (mk < 0) tmp += mk;
    dp[node][1] = tmp;
    tmp = 1;
    for (int e : G[node]) tmp += std::min(dp[e][0], dp[e][1]);
    dp[node][0] = std::min(dp[node][0], tmp);
  }
  G[node].clear();
}
int main() {
  std::scanf("%d", &n);
  for (int i = 2; i <= n; ++i) {
    int u, v;
    std::scanf("%d%d", &u, &v);
    add(u, v), add(v, u);
  }
  dfs1(1, 0);
  dfs2(1, 0, 1);
  std::scanf("%d", &q);
  while (q--) {
    std::scanf("%d", &k);
    for (int i = 1; i <= k; ++i) std::scanf("%d", h + i);
    std::sort(h + 1, h + 1 + k,
              [](const int &a, const int &b) { return dfn[a] < dfn[b]; });
    st[tp = 1] = 1;
    for (int i = 1 + (h[1] == 1); i <= k; ++i) {
      int x = lca(h[i], st[tp]);
      if (x != st[tp]) {
        while (dep[st[tp]] > dep[x]) {
          if (dep[st[tp - 1]] > dep[x])
            G[st[tp - 1]].push_back(st[tp]);
          else
            G[x].push_back(st[tp]);
          --tp;
        }
        if (x != st[tp]) st[++tp] = x;
      }
      st[++tp] = h[i];
    }
    for (int i = 1; i < tp; ++i) G[st[i]].push_back(st[i + 1]);
    for (int i = 1; i <= k; ++i) isKey[h[i]] = true;
    dfs(1);
    for (int i = 1; i <= k; ++i) isKey[h[i]] = false;
    int ans = std::min(dp[1][0], dp[1][1]);
    if (ans <= n)
      std::printf("%d\n", ans);
    else
      std::puts("-1");
  }
  return 0;
}
