#include <bits/stdc++.h>
using namespace std;
struct lsqy {
  int next, to;
} q[200001], e[200001];
int head[200001], cnt;
int Head[200001], ct;
int dfn[100001], dep[100001];
int n, m, d;
int ff[100001][22];
void add(int x, int y) {
  q[++cnt].next = head[x];
  head[x] = cnt;
  q[cnt].to = y;
}
void dad(int x, int y) {
  e[++ct].next = Head[x];
  Head[x] = ct;
  e[ct].to = y;
  e[++ct].next = Head[y];
  Head[y] = ct;
  e[ct].to = x;
}
int toot = 0;
void dfs(int u, int fa) {
  ff[u][0] = fa;
  dep[u] = dep[fa] + 1;
  dfn[u] = ++toot;
  for (int i = head[u]; i; i = q[i].next) {
    int v = q[i].to;
    if (v == fa) continue;
    dfs(v, u);
  }
}
void LCA() {
  for (int j = 1; j <= 20; ++j)
    for (int i = 1; i <= n; ++i) ff[i][j] = ff[ff[i][j - 1]][j - 1];
}
int lca(int x, int y) {
  if (dep[x] < dep[y]) swap(x, y);
  for (int i = 20; i >= 0; i--)
    if (dep[ff[x][i]] >= dep[y]) x = ff[x][i];
  if (x == y) return x;
  for (int i = 20; i >= 0; i--)
    if (ff[x][i] != ff[y][i]) x = ff[x][i], y = ff[y][i];
  return ff[x][0];
}
bool cmp(int x, int y) { return dfn[x] < dfn[y]; }
int can = 0, di;
int sta[100001], t[100001], id[100001], dp[100001], g[100001];
void dfs2(int now, int fa) {
  for (int i = Head[now]; i; i = e[i].next) {
    int u = e[i].to;
    if (u == fa) continue;
    dfs2(u, now);
  }
  dp[now] = g[now] = 0;
  if (t[now] == d) {
    for (int i = Head[now]; i; i = e[i].next) {
      int u = e[i].to;
      if (t[u] == d && abs(dep[u] - dep[now]) == 1) can = -1;
      if (u == fa) continue;
      dp[now] += dp[u] + g[u];
    }
    g[now] = 1;
  } else {
    int Sum = 0;
    for (int i = Head[now]; i; i = e[i].next) {
      int u = e[i].to;
      if (u == fa) continue;
      dp[now] += dp[u];
      if (g[u]) ++Sum;
    }
    if (Sum <= 1)
      g[now] = Sum;
    else
      dp[now]++;
  }
  Head[now] = 0;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i < n; ++i) {
    int u, v;
    scanf("%d%d", &u, &v);
    add(u, v);
    add(v, u);
  }
  dfs(1, 0);
  LCA();
  scanf("%d", &m);
  for (d = 1; d <= m; ++d) {
    int k, cnnt = can = 0, top;
    scanf("%d", &k);
    for (int i = 1; i <= k; ++i) {
      int x;
      scanf("%d", &x);
      t[x] = d;
      id[++cnnt] = x;
    }
    sort(id + 1, id + 1 + cnnt, cmp);
    sta[top = 1] = 1;
    for (int i = 1; i <= cnnt; ++i) {
      if (id[i] == 1) continue;
      int l = lca(sta[top], id[i]);
      while (dep[sta[top - 1]] > dep[l]) {
        dad(sta[top - 1], sta[top]);
        top--;
      }
      if (sta[top] != l) {
        if (sta[top - 1] == l)
          dad(sta[top - 1], sta[top]), top--;
        else
          dad(l, sta[top]), sta[top] = l;
      }
      sta[++top] = id[i];
    }
    while (top > 1) {
      dad(sta[top - 1], sta[top]);
      top--;
    }
    dfs2(1, 0);
    if (!can)
      printf("%d\n", dp[1]);
    else
      puts("-1");
    ct = 0;
  }
}
