#include <bits/stdc++.h>
using namespace std;
const int INF = 1 << 28;
int stot, a[200005], n, m, x, y, ans, q;
struct stack {
  int sta[200005], TOP;
  void push(int x) { sta[++TOP] = x; }
  void pop() { TOP--; }
  int size() { return TOP; }
  int top() { return sta[TOP]; }
  int stop() { return sta[TOP - 1]; }
} S;
struct st_table {
  int mn[200005 * 2][25], wz[200005], logt[200005], dep[200005];
  int smin(int x, int y) {
    if (dep[x] < dep[y])
      return x;
    else
      return y;
  }
  void init() {
    for (int k = 1; (1 << k) <= stot; k++)
      for (int i = 1; i + (1 << k) - 1 <= stot; i++)
        mn[i][k] = smin(mn[i][k - 1], mn[i + (1 << (k - 1))][k - 1]);
    for (int i = 2; i <= stot; i++) logt[i] = logt[i >> 1] + 1;
  }
  int find_lca(int x, int y) {
    x = wz[x];
    y = wz[y];
    if (x > y) swap(x, y);
    int e = logt[y - x + 1];
    return smin(mn[x][e], mn[y - (1 << e) + 1][e]);
  }
} ST;
struct fake_tree {
  int hed[200005], ver[200005], nxt[200005], val[200005], tot;
  int f[200005], g[200005], vis[200005];
  void push(int x, int y) {
    ver[++tot] = y;
    nxt[tot] = hed[x];
    hed[x] = tot;
  }
  void dfs(int now) {
    f[now] = g[now] = 0;
    int lsbl = 1, tmp = 0;
    if (vis[now]) f[now] = INF;
    for (int i = hed[now]; i; i = nxt[i]) {
      dfs(ver[i]);
      if (vis[now]) {
        g[now] += f[ver[i]];
        f[now] = INF;
      } else {
        g[now] += f[ver[i]];
        tmp = min(tmp, g[ver[i]] - f[ver[i]]);
        f[now] += f[ver[i]];
        lsbl += g[ver[i]];
      }
    }
    if (!vis[now]) f[now] = min(f[now], lsbl);
    g[now] += tmp;
    f[now] = min(g[now] + 1, f[now]);
    g[now] = min(g[now], f[now]);
    vis[now] = hed[now] = 0;
    return;
  }
} FT;
bool cmp(const int &a, const int &b);
struct tree {
  int hed[200005], ver[200005 * 2], nxt[200005 * 2], tot;
  int dfn[200005], dtot, fa[200005];
  void push(int x, int y) {
    ver[++tot] = y;
    nxt[tot] = hed[x];
    hed[x] = tot;
  }
  void dfs_st(int now, int en) {
    ST.wz[now] = ++stot;
    fa[now] = en;
    ST.mn[stot][0] = now;
    ST.dep[now] = ST.dep[en] + 1;
    dfn[now] = ++dtot;
    for (int i = hed[now]; i; i = nxt[i]) {
      if (ver[i] == en) continue;
      dfs_st(ver[i], now);
      ST.mn[++stot][0] = now;
    }
  }
  void build_fake_tree() {
    FT.tot = 0;
    while (S.size()) S.pop();
    S.push(1);
    int now, x, y, lca;
    for (int i = 1; i <= m; i++) {
      now = a[i];
      if (S.size() == 1) {
        if (now != 1) S.push(now);
        continue;
      }
      while (true) {
        x = S.top();
        y = S.stop();
        lca = ST.find_lca(x, now);
        if (x == lca) {
          S.push(now);
          break;
        }
        if (dfn[y] < dfn[lca]) {
          FT.push(lca, x);
          S.pop();
          S.push(lca);
          S.push(now);
          break;
        }
        if (dfn[y] == dfn[lca]) {
          FT.push(y, x);
          S.pop();
          S.push(now);
          break;
        }
        if (dfn[y] > dfn[lca]) {
          FT.push(y, x);
          S.pop();
          continue;
        }
      }
    }
    while (S.size() > 1) {
      x = S.top();
      y = S.stop();
      FT.push(y, x);
      S.pop();
    }
    S.pop();
  }
} T;
bool cmp(const int &a, const int &b) { return T.dfn[a] < T.dfn[b]; }
int main() {
  scanf("%d", &n);
  for (int i = 1; i < n; i++) {
    scanf("%d%d", &x, &y);
    T.push(x, y);
    T.push(y, x);
  }
  T.dfs_st(1, 0);
  ST.init();
  scanf("%d", &q);
  for (int i = 1; i <= q; i++) {
    scanf("%d", &m);
    for (int j = 1; j <= m; j++) scanf("%d", &a[j]), FT.vis[a[j]] = 1;
    sort(a + 1, a + 1 + m, cmp);
    ans = 0;
    for (int i = 1; i <= m; i++)
      if (FT.vis[T.fa[a[i]]]) ans = -1;
    if (ans == -1)
      puts("-1");
    else {
      T.build_fake_tree();
      FT.dfs(1);
      ans = min(FT.f[1], FT.g[1]);
      printf("%d\n", ans);
    }
    for (int j = 1; j <= m; j++) FT.vis[a[j]] = 0;
  }
  return 0;
}
