#include <bits/stdc++.h>
using namespace std;
const int maxn = 100010;
const long long Mod = 998244353;
struct node {
  int v, next;
} e[maxn << 1];
int h[maxn], cnt = 1;
inline void Add(int u, int v) {
  e[cnt] = (node){v, h[u]};
  h[u] = cnt++;
}
int fa[maxn], dep[maxn], siz[maxn], hson[maxn], dfn[maxn], low[maxn], top[maxn],
    tim;
void dfs1(int u, int ff) {
  fa[u] = ff;
  dep[u] = dep[ff] + 1;
  siz[u] = 1;
  for (int i = h[u]; i; i = e[i].next) {
    int v = e[i].v;
    if (v == ff) continue;
    dfs1(v, u);
    siz[u] += siz[v];
    if (siz[v] > siz[hson[u]]) hson[u] = v;
  }
}
void dfs2(int u, int tp) {
  top[u] = tp;
  dfn[u] = ++tim;
  if (hson[u]) dfs2(hson[u], tp);
  for (int i = h[u]; i; i = e[i].next)
    if (e[i].v != fa[u] && e[i].v != hson[u]) dfs2(e[i].v, e[i].v);
  low[u] = tim;
}
int LCA(int u, int v) {
  while (top[u] ^ top[v])
    dep[top[u]] < dep[top[v]] ? v = fa[top[v]] : u = fa[top[u]];
  return dep[u] < dep[v] ? u : v;
}
int p[maxn << 1], S[maxn];
bool cmp(int a, int b) { return dfn[a] < dfn[b]; }
int f[maxn], g[maxn], n, Q, K;
bool FL = false, vis[maxn];
void DP(int u) {
  for (int i = h[u]; i; i = e[i].next) {
    int v = e[i].v;
    DP(v);
    f[u] += f[v];
    g[u] += g[v];
  }
  if (vis[u]) {
    f[u] += g[u];
    g[u] = 1;
  } else {
    f[u] += (g[u] > 1);
    g[u] = (g[u] == 1);
  }
}
int Calc(int rt) {
  DP(rt);
  for (int i = 1; i <= K; ++i)
    if (vis[p[i]] && vis[fa[p[i]]]) return -1;
  return f[rt];
}
int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  ;
  cin >> n;
  for (int i = 1, u, v; i < n; ++i) {
    cin >> u >> v;
    Add(u, v);
    Add(v, u);
  }
  dfs1(1, 0);
  dfs2(1, 1);
  memset(h, 0, sizeof(h));
  cin >> Q;
  while (Q--) {
    cin >> K;
    cnt = 1;
    for (int i = 1; i <= K; ++i) {
      cin >> p[i];
      vis[p[i]] = 1;
    }
    sort(p + 1, p + K + 1, cmp);
    for (int i = K; i > 1; --i) p[++K] = LCA(p[i], p[i - 1]);
    sort(p + 1, p + K + 1, cmp);
    K = unique(p + 1, p + K + 1) - p - 1;
    for (int i = 1, tp = 0; i <= K; ++i) {
      while (tp && low[S[tp]] < dfn[p[i]]) tp--;
      Add(S[tp], p[i]);
      S[++tp] = p[i];
    }
    cout << Calc(p[1]) << endl;
    for (int i = 1; i <= K; ++i) {
      h[p[i]] = 0;
      vis[p[i]] = 0;
      f[p[i]] = g[p[i]] = 0;
    }
  }
  return 0;
}
