#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 9, M = 2 * N;
int n, m, q[N], head[N], cnt, to[M], nxt[M];
int sz[N], fa[N], son[N], d[N], tp[N], id[N], ind;
int st[N], top;
int vcnt, vhead[N], vto[M], vnxt[M];
bool flag = 1, vis[N], g[N];
int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
bool cmp(int x, int y) { return id[x] < id[y]; }
void add(int u, int v) {
  vto[++vcnt] = v;
  vnxt[vcnt] = vhead[u];
  vhead[u] = vcnt;
}
void dfs1(int x, int dep) {
  d[x] = dep, sz[x] = 1;
  for (int i = head[x], v; i; i = nxt[i]) {
    if (to[i] == fa[x]) continue;
    fa[v = to[i]] = x;
    dfs1(v, dep + 1);
    sz[x] += sz[v];
    if (sz[v] > sz[son[x]]) son[x] = v;
  }
}
void dfs2(int x) {
  id[x] = ++ind;
  if (!tp[x]) tp[x] = tp[fa[x]];
  if (!son[x]) return;
  dfs2(son[x]);
  for (int i = head[x], v; i; i = nxt[i]) {
    if (id[v = to[i]]) continue;
    tp[v] = v;
    dfs2(v);
  }
}
int lca(int x, int y) {
  while (tp[x] != tp[y])
    if (d[tp[x]] > d[tp[y]])
      x = fa[tp[x]];
    else
      y = fa[tp[y]];
  return d[x] < d[y] ? x : y;
}
int dp(int x) {
  int p = 0, f = 0;
  for (int i = vhead[x]; i; i = vnxt[i]) f += dp(vto[i]), p += g[vto[i]];
  if (vis[x])
    f += p, g[x] = 1;
  else if (p > 1)
    ++f, g[x] = 0;
  else
    g[x] = p ? 1 : 0;
  vhead[x] = 0, vis[x] = 0;
  return f;
}
int main() {
  n = read();
  for (int i = 1, u, v; i < n; i++) {
    u = read();
    v = read();
    to[++cnt] = v;
    nxt[cnt] = head[u];
    head[u] = cnt;
    to[++cnt] = u;
    nxt[cnt] = head[v];
    head[v] = cnt;
  }
  tp[1] = 1;
  dfs1(1, 1);
  dfs2(1);
  m = read();
  for (int k; m-- && (k = read()); flag = 1) {
    for (int i = 1; i <= k; i++) q[i] = read(), vis[q[i]] = 1;
    for (int i = 1; i <= k; i++)
      if (vis[fa[q[i]]]) flag = 0;
    if (!flag) {
      for (int i = 1; i <= k; ++i) vis[q[i]] = 0;
      puts("-1");
      continue;
    }
    sort(q + 1, q + k + 1, cmp);
    st[top = 1] = q[1];
    for (int i = 2, z; i <= k; i++) {
      z = lca(st[top], q[i]);
      while (d[z] < d[st[top - 1]]) add(st[top - 1], st[top]), top--;
      if (z != st[top]) {
        add(z, st[top]);
        if (st[top - 1] == z)
          top--;
        else
          st[top] = z;
      }
      st[++top] = q[i];
    }
    while (--top) add(st[top], st[top + 1]);
    printf("%d\n", dp(st[1])), vcnt = 0;
  }
  return 0;
}
