#include <bits/stdc++.h>
const int maxm = 300005;
const int maxn = 300005;
using namespace std;
struct edge {
  int to, next;
} e[maxm << 1];
int n;
int first[maxn], np, a[maxn], s[maxn], dc, fa[maxn][22], dep[maxn],
    tt = 0, ans, sz[maxn], inq[maxn];
void addedge(int u, int v) {
  e[++np] = (edge){v, first[u]};
  first[u] = np;
}
int lca(int u, int v) {
  if (dep[u] < dep[v]) swap(u, v);
  int len = dep[u] - dep[v];
  for (int i = 18; i >= 0; i--)
    if (len & (1 << i)) u = fa[u][i];
  if (u == v) return u;
  for (int i = 18; i >= 0; i--) {
    if (fa[u][i] != fa[v][i]) {
      u = fa[u][i];
      v = fa[v][i];
    }
  }
  return fa[u][0];
}
void dfs(int now) {
  s[now] = ++dc;
  for (int i = 1; i <= 18; i++) fa[now][i] = fa[fa[now][i - 1]][i - 1];
  for (int p = first[now]; p != 0; p = e[p].next) {
    int j = e[p].to;
    if (fa[now][0] == j) continue;
    dep[j] = dep[now] + 1;
    fa[j][0] = now;
    dfs(j);
  }
}
bool comp(int x, int y) { return s[x] < s[y]; }
bool comp2(int x, int y) { return x == y; }
int b[maxn], c[maxn], top = 0;
;
struct mytree {
  edge e[maxm << 1];
  int first[maxn], np, fa[maxn];
  void addedge(int u, int v) {
    e[++np] = (edge){v, first[u]};
    first[u] = np;
  }
  void dfs2(int now) {
    sz[now] = (inq[now] == tt);
    for (int p = first[now]; p != 0; p = e[p].next) {
      int j = e[p].to;
      if (fa[now] == j) continue;
      fa[j] = now;
      dfs2(j);
      if (sz[j] != 0) {
        if (inq[now] == tt)
          ans++;
        else
          sz[now]++;
      }
    }
    if (sz[now] >= 2) ans++, sz[now] = 0;
  }
} fe;
void treepop() {
  if (c[top - 1] != b[top - 1]) {
    fe.addedge(c[top - 1], b[top]);
    fe.addedge(c[top - 1], b[top - 1]);
  } else
    fe.addedge(c[top - 1], b[top]);
  top--;
  b[top] = c[top];
  if (top > 1) c[top - 1] = lca(b[top], b[top - 1]);
}
void maketree(int k) {
  top = 0;
  b[++top] = a[1];
  int tot = k;
  for (int i = 2; i <= k; i++) {
    int mylca = lca(b[top], a[i]);
    if (inq[mylca] != tt && inq[mylca] != -tt)
      inq[mylca] = -tt, a[++tot] = mylca;
    while (top > 1 && dep[mylca] <= dep[c[top - 1]]) treepop();
    c[top] = mylca;
    b[++top] = a[i];
  }
  while (top > 1) treepop();
  fe.fa[b[1]] = 0;
  fe.dfs2(b[1]);
  fe.np = 0;
  for (int i = 1; i <= tot; i++) fe.first[a[i]] = 0;
}
int main() {
  int ai, bi;
  scanf("%d", &n);
  for (int i = 1; i < n; i++) {
    scanf("%d%d", &ai, &bi);
    addedge(ai, bi);
    addedge(bi, ai);
  }
  dfs(1);
  int q;
  scanf("%d", &q);
  for (int i = 1; i <= q; i++) {
    int k;
    scanf("%d", &k);
    tt++;
    ans = 0;
    for (int ii = 1; ii <= k; ii++) {
      scanf("%d", &a[ii]);
      inq[a[ii]] = tt;
    }
    sort(a + 1, a + k + 1, comp);
    k = unique(a + 1, a + k + 1, comp2) - a;
    k--;
    int isok = 1;
    for (int ii = 1; ii <= k; ii++)
      if (inq[fa[a[ii]][0]] == tt) {
        isok = 0;
        break;
      }
    if (isok == 0)
      printf("-1\n");
    else
      maketree(k), printf("%d\n", ans);
  }
  return 0;
}
