#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 10, maxm = 2e5 + 10;
int heade[maxn], ev[maxm], nexte[maxm];
int size[maxn], dep[maxn], fa[maxn], son[maxn];
int top[maxn], a[maxn], s[maxn], dfn[maxn];
int n, m, k, tot = 0, cnt, idx = 0, ans, root;
void add_edge(int u, int v) {
  ev[++tot] = v;
  nexte[tot] = heade[u];
  heade[u] = tot;
}
void fdfs(int ui) {
  int i, vi;
  size[ui] = 1;
  son[ui] = 0;
  dfn[ui] = ++idx;
  for (i = heade[ui]; i; i = nexte[i]) {
    vi = ev[i];
    if (vi == fa[ui]) continue;
    dep[vi] = dep[ui] + 1;
    fa[vi] = ui;
    fdfs(vi);
    size[ui] += size[vi];
    if (size[vi] > size[son[ui]]) son[ui] = vi;
  }
}
void sdfs(int ui, int anc) {
  int i, vi;
  top[ui] = anc;
  if (son[ui]) sdfs(son[ui], anc);
  for (i = heade[ui]; i; i = nexte[i]) {
    vi = ev[i];
    if (vi == son[ui] || vi == fa[ui]) continue;
    sdfs(vi, vi);
  }
}
int lca(int u, int v) {
  int x = top[u], y = top[v];
  while (x != y) {
    if (dep[x] < dep[y]) {
      swap(u, v);
      swap(x, y);
    }
    u = fa[x];
    x = top[u];
  }
  return dep[u] < dep[v] ? u : v;
}
void ins(int x) {
  if (!cnt) {
    s[++cnt] = x;
    return;
  }
  int u = lca(x, s[cnt]);
  while (cnt > 1 && dep[u] < dep[s[cnt - 1]]) {
    add_edge(s[cnt - 1], s[cnt]);
    cnt--;
  }
  if (dep[u] < dep[s[cnt]]) add_edge(u, s[cnt--]);
  if (!cnt || s[cnt] != u) s[++cnt] = u;
  s[++cnt] = x;
}
void dfs(int ui) {
  int i, vi;
  if (size[ui]) {
    for (i = heade[ui]; i; i = nexte[i]) {
      vi = ev[i];
      dfs(vi);
      if (size[vi]) {
        size[vi] = 0;
        ans++;
      }
    }
  } else {
    for (i = heade[ui]; i; i = nexte[i]) {
      vi = ev[i];
      dfs(vi);
      size[ui] += size[vi];
      size[vi] = 0;
    }
    if (size[ui] > 1) {
      ans++;
      size[ui] = 0;
    }
  }
  heade[ui] = 0;
}
int cmp(int x, int y) { return dfn[x] < dfn[y]; }
int main() {
  int i, j, u, v;
  bool flag;
  cin >> n;
  for (i = 1; i < n; i++) {
    scanf("%d%d", &u, &v);
    add_edge(u, v);
    add_edge(v, u);
  }
  fdfs(1);
  sdfs(1, 1);
  memset(size, 0, sizeof(size));
  memset(heade, 0, sizeof(heade));
  cin >> m;
  while (m--) {
    scanf("%d", &k);
    tot = cnt = ans = 0;
    flag = 0;
    for (i = 1; i <= k; i++) {
      scanf("%d", &a[i]);
      size[a[i]] = 1;
    }
    for (i = 1; i <= k; i++) {
      if (size[fa[a[i]]]) {
        flag = 1;
        break;
      }
    }
    if (flag) {
      printf("-1\n");
      for (i = 1; i <= k; i++) size[a[i]] = 0;
      continue;
    }
    sort(a + 1, a + k + 1, cmp);
    for (i = 1; i <= k; i++) ins(a[i]);
    root = s[1];
    for (i = 1; i < cnt; i++) add_edge(s[i], s[i + 1]);
    dfs(root);
    size[root] = 0;
    printf("%d\n", ans);
  }
  return 0;
}
