#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
const int LOG = 20;
struct Edge {
  int to, nxt;
} E[N << 1];
int n, tot, now, top, timer, m;
int a[N], head[N], father[N][LOG], st[N], dep[N], key[N], f[N], g[N], p[N],
    dfn[N];
template <typename T>
inline void chkmax(T &x, T y) {
  x = max(x, y);
}
template <typename T>
inline void chkmin(T &x, T y) {
  x = min(x, y);
}
template <typename T>
inline void read(T &x) {
  T f = 1;
  x = 0;
  char c = getchar();
  for (; !isdigit(c); c = getchar())
    if (c == '-') f = -f;
  for (; isdigit(c); c = getchar()) x = (x << 3) + (x << 1) + c - '0';
  x *= f;
}
inline void AddEdge(int u, int v) {
  E[++tot] = (Edge){v, head[u]};
  head[u] = tot;
}
inline void DFS(int u, int fa) {
  father[u][0] = fa;
  dep[u] = dep[fa] + 1;
  dfn[u] = ++timer;
  for (int i = 1; i < LOG; ++i) father[u][i] = father[father[u][i - 1]][i - 1];
  for (int i = head[u]; i; i = E[i].nxt) {
    int v = E[i].to;
    if (v == fa) continue;
    DFS(v, u);
  }
}
inline int LCA(int x, int y) {
  if (dep[x] > dep[y]) swap(x, y);
  for (int i = LOG - 1; i >= 0; --i)
    if (dep[father[y][i]] >= dep[x]) y = father[y][i];
  if (x == y) return x;
  for (int i = LOG - 1; i >= 0; --i)
    if (father[x][i] != father[y][i]) x = father[x][i], y = father[y][i];
  return father[x][0];
}
inline bool cmp(int x, int y) { return dfn[x] < dfn[y]; }
inline int calc(int x) {
  p[++now] = x;
  int ret = 0, foo = 0;
  for (int i = head[x]; i; i = E[i].nxt)
    ret += calc(E[i].to), foo += g[E[i].to];
  if (key[x])
    ret += foo, g[x] = 1;
  else if (foo > 1)
    ++ret, g[x] = 0;
  else
    g[x] = foo;
  return ret;
}
inline void solve() {
  read(m);
  top = now = tot = 0;
  bool ok = 1;
  for (int i = 1; i <= m; ++i) read(a[i]), key[a[i]] = true;
  for (int i = 1; i <= m; ++i) ok &= key[father[a[i]][0]] == 0;
  if (!ok) {
    for (int i = 1; i <= m; ++i) key[a[i]] = false;
    printf("-1\n");
    return;
  }
  sort(a + 1, a + 1 + m, cmp);
  if (!key[1]) st[++top] = 1;
  for (int i = 1; i <= m; ++i) {
    int x = a[i], o = 0;
    while (top > 0) {
      o = LCA(x, st[top]);
      if (top > 1 && dep[st[top - 1]] > dep[o]) {
        AddEdge(st[top - 1], st[top]);
        --top;
      } else if (dep[st[top]] > dep[o]) {
        AddEdge(o, st[top]);
        --top;
        break;
      } else
        break;
    }
    if (st[top] != o) st[++top] = o;
    st[++top] = x;
  }
  while (top > 1) AddEdge(st[top - 1], st[top]), --top;
  printf("%d\n", calc(1));
  for (int i = 1; i <= now; ++i) key[p[i]] = head[p[i]] = 0;
}
int main() {
  read(n);
  for (int i = 1; i < n; ++i) {
    int u, v;
    read(u), read(v);
    AddEdge(u, v), AddEdge(v, u);
  }
  DFS(1, 0);
  int q;
  read(q);
  for (int i = 1; i <= n; ++i) head[i] = 0;
  while (q--) solve();
  return 0;
}
