#include <bits/stdc++.h>
using namespace std;
const int MAXZS = 16;
const long long inf = (long long)1e16;
long long NUMIN, PIN, n, m, head[100010], EDGENUM, xh[100010], XEDGE,
    fa[100010][20], dep[100010], pw[20], dfn[100010], nt, line[100010], K,
    sta[100010], tp, f[100010][2];
bool bj[100010], ff;
struct EDGE {
  int to, nx, val;
} e[200010], xe[100010];
char CI;
inline long long read() {
  NUMIN = 0, PIN = 1;
  CI = 0;
  while (CI < '0' || CI > '9') {
    if (CI == '-') PIN = -1;
    CI = getchar();
  }
  while (CI >= '0' && CI <= '9') {
    NUMIN = NUMIN * 10 + CI - '0';
    CI = getchar();
  }
  return NUMIN * PIN;
}
inline void build(int from, int to) {
  e[++EDGENUM].to = to;
  e[EDGENUM].nx = head[from];
  head[from] = EDGENUM;
}
inline void dfs(int node) {
  for (int i = 1; i <= MAXZS; i++) {
    if (dep[node] < pw[i]) break;
    fa[node][i] = fa[fa[node][i - 1]][i - 1];
  }
  nt++;
  dfn[node] = nt;
  for (int i = head[node]; i; i = e[i].nx)
    if (e[i].to != fa[node][0]) {
      fa[e[i].to][0] = node;
      dep[e[i].to] = dep[node] + 1;
      dfs(e[i].to);
    }
}
inline bool cmp(const int a1, const int a2) { return dfn[a1] < dfn[a2]; }
inline int LCA(int a1, int a2) {
  if (dep[a1] > dep[a2]) {
    a1 ^= a2;
    a2 ^= a1;
    a1 ^= a2;
  }
  for (int i = MAXZS; i >= 0; i--)
    if (dep[a2] - pw[i] >= dep[a1]) a2 = fa[a2][i];
  if (a1 == a2) return a1;
  for (int i = MAXZS; i >= 0; i--)
    if (dep[a1] >= pw[i] && fa[a1][i] != fa[a2][i]) {
      a1 = fa[a1][i];
      a2 = fa[a2][i];
    }
  return fa[a1][0];
}
inline void xbuild(int from, int to) {
  xe[++XEDGE].to = to;
  xe[XEDGE].nx = xh[from];
  xe[XEDGE].val = dep[to] - dep[from] - 1;
  xh[from] = XEDGE;
}
inline long long min(const long long a1, const long long a2) {
  return a1 < a2 ? a1 : a2;
}
inline void dp(int node) {
  long long nw = 0, s = 0, tot1 = 0, tot2 = 0;
  if (!bj[node]) {
    f[node][0] = f[node][1] = 0;
    for (int i = xh[node]; i; i = xe[i].nx) {
      dp(xe[i].to);
      tot1 += f[xe[i].to][0];
      tot2 += min(f[xe[i].to][0], f[xe[i].to][1]);
      if (!xe[i].val)
        nw = inf;
      else
        nw = f[xe[i].to][1] + 1;
      f[node][1] =
          min(f[node][1] + min(f[xe[i].to][0], nw), s + f[xe[i].to][1]);
      s += min(f[xe[i].to][0], nw);
    }
    f[node][0] = min(tot1, tot2 + 1);
  } else {
    f[node][1] = 0;
    for (int i = xh[node]; i; i = xe[i].nx) {
      dp(xe[i].to);
      if (!xe[i].val)
        nw = inf;
      else
        nw = f[xe[i].to][1] + 1;
      f[node][1] += min(f[xe[i].to][0], nw);
    }
    f[node][0] = inf;
  }
  xh[node] = 0;
}
int main() {
  n = read();
  pw[0] = 1;
  for (int i = 1; i <= MAXZS; i++) pw[i] = pw[i - 1] * 2;
  int a, b;
  for (int i = 1; i < n; i++) {
    a = read();
    b = read();
    build(a, b);
    build(b, a);
  }
  dfs(1);
  m = read();
  for (int Num = 1; Num <= m; Num++) {
    ff = false;
    if (Num > 1)
      for (int i = 1; i <= K; i++) bj[line[i]] = false;
    K = read();
    XEDGE = 0;
    for (int i = 1; i <= K; i++) {
      line[i] = read();
      bj[line[i]] = true;
    }
    if (K == 1) {
      printf("0\n");
      continue;
    }
    for (int i = 1; i <= K; i++)
      if (bj[fa[line[i]][0]]) {
        printf("-1\n");
        ff = true;
        break;
      }
    if (ff) continue;
    sort(line + 1, line + K + 1, cmp);
    sta[1] = 1;
    sta[2] = line[1];
    tp = 2;
    if (line[1] == 1) sta[2] = line[2];
    for (int i = (line[1] == 1 ? 3 : 2); i <= K; i++) {
      a = LCA(line[i], sta[tp]);
      if (sta[tp] == a)
        sta[++tp] = line[i];
      else {
        while (tp > 1 && dep[sta[tp - 1]] > dep[a]) {
          xbuild(sta[tp - 1], sta[tp]);
          tp--;
        }
        if (dep[sta[tp - 1]] == dep[a]) {
          xbuild(sta[tp - 1], sta[tp]);
          tp--;
        } else {
          xbuild(a, sta[tp]);
          sta[tp] = a;
        }
        if (sta[tp] != line[i]) sta[++tp] = line[i];
      }
    }
    while (tp > 1) {
      xbuild(sta[tp - 1], sta[tp]);
      tp--;
    }
    dp(1);
    printf("%lld\n", min(f[1][0], f[1][1]));
  }
  return 0;
}
