#include <bits/stdc++.h>
using namespace std;
const int maxn = 100000 + 10;
int n, m;
vector<int> g[maxn], vg[maxn];
int dep[maxn], dfn[maxn];
int jump[maxn][22];
int cnt_dfn, tp;
int v[maxn];
bool flag[maxn];
int sta[maxn];
int f1[maxn], f2[maxn];
void dfs1(int x, int fa) {
  dfn[x] = ++cnt_dfn;
  jump[x][0] = fa;
  for (int i = 0; i < g[x].size(); i++) {
    int q = g[x][i];
    if (q != fa) {
      dep[q] = dep[x] + 1;
      dfs1(q, x);
    }
  }
}
int lca(int x, int y) {
  if (dep[x] < dep[y]) swap(x, y);
  int dt = dep[x] - dep[y];
  for (int j = 0; j <= 20; j++) {
    if ((1 << j) & dt) x = jump[x][j];
  }
  if (x == y) return x;
  for (int j = 20; j >= 0; j--) {
    if (jump[x][j] != jump[y][j]) {
      x = jump[x][j];
      y = jump[y][j];
    }
  }
  return jump[x][0];
}
bool cmp(int x, int y) { return dfn[x] < dfn[y]; }
void add(int x, int y) { vg[x].push_back(y); }
void ins(int x) {
  if (tp == 0) {
    sta[++tp] = x;
    return;
  }
  int anc = lca(sta[tp], x);
  while (tp > 1 && dep[anc] < dep[sta[tp - 1]]) {
    add(sta[tp - 1], sta[tp]);
    tp--;
  }
  if (dep[anc] < dep[sta[tp]]) add(anc, sta[tp--]);
  if ((!tp) || (sta[tp] != anc)) sta[++tp] = anc;
  sta[++tp] = x;
}
void dfs2(int x) {
  if (flag[x])
    f2[x] = 1;
  else
    f2[x] = 0;
  f1[x] = 0;
  int cnt = 0;
  for (int i = 0; i < vg[x].size(); i++) {
    int q = vg[x][i];
    dfs2(q);
    f1[x] += f1[q];
    cnt += f2[q];
  }
  if (flag[x])
    f1[x] += cnt;
  else {
    if (cnt == 1)
      f2[x] = 1;
    else if (cnt > 1)
      f1[x]++;
  }
  vg[x].clear();
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i < n; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    g[x].push_back(y);
    g[y].push_back(x);
  }
  dfs1(1, 0);
  for (int j = 1; j <= 20; j++) {
    for (int i = 1; i <= n; i++) {
      jump[i][j] = jump[jump[i][j - 1]][j - 1];
    }
  }
  scanf("%d", &m);
  while (m--) {
    int num;
    scanf("%d", &num);
    for (int i = 1; i <= num; i++) {
      int x;
      scanf("%d", &x);
      v[i] = x;
    }
    sort(v + 1, v + num + 1, cmp);
    bool jud = 1;
    for (int i = 1; i <= num; i++) flag[v[i]] = 1;
    for (int i = 1; i <= num; i++) {
      if (flag[v[i]] && flag[jump[v[i]][0]]) jud = 0;
    }
    if (!jud) {
      printf("-1\n");
      for (int i = 1; i <= num; i++) flag[v[i]] = 0;
      continue;
    }
    tp = 0;
    for (int i = 1; i <= num; i++) {
      ins(v[i]);
    }
    int rt = sta[1];
    while (--tp) add(sta[tp], sta[tp + 1]);
    dfs2(rt);
    for (int i = 1; i <= num; i++) flag[v[i]] = 0;
    printf("%d\n", f1[rt]);
  }
  return 0;
}
