#include <bits/stdc++.h>
using namespace std;
inline int gi() {
  char c = 'a';
  int x = 0;
  for (; c < '0' || c > '9'; c = getchar())
    ;
  for (; c >= '0' && c <= '9'; c = getchar()) x = (x << 1) + (x << 3) + c - '0';
  return x;
}
const int N = 100005;
int head[N], nxt[N << 1], to[N << 1], fa[N], size[N], dep[N], st[N], ed[N], tim,
    a[N << 2], s[N << 2];
int head2[N], nxt2[N << 1], to2[N << 1], tot;
int son[N], top[N];
int f[N], g[N], n, q, k, vis[N];
bool key[N];
void addedge(int u, int v, int now) {
  nxt[now] = head[u], head[u] = now, to[now] = v;
}
void addedge2(int u, int v) {
  nxt2[++tot] = head2[u], head2[u] = tot, to2[tot] = v;
}
void dfs(int u) {
  st[u] = ++tim;
  size[u] = 1;
  for (int e = head[u]; e; e = nxt[e]) {
    if (to[e] == fa[u]) continue;
    fa[to[e]] = u;
    dep[to[e]] = dep[u] + 1;
    dfs(to[e]);
    size[u] += size[to[e]];
    if (size[to[e]] > size[son[u]]) son[u] = to[e];
  }
  ed[u] = ++tim;
}
void dfs2(int u, int tp) {
  top[u] = tp;
  if (son[u]) dfs2(son[u], tp);
  for (int e = head[u]; e; e = nxt[e])
    if (to[e] != fa[u] && to[e] != son[u]) dfs2(to[e], to[e]);
}
int lca(int u, int v) {
  while (top[u] != top[v])
    dep[top[u]] > dep[top[v]] ? u = fa[top[u]] : v = fa[top[v]];
  return dep[u] < dep[v] ? u : v;
}
bool cmp(int x, int y) { return st[x] < st[y]; }
void dp(int u) {
  for (int e = head2[u]; e; e = nxt2[e]) {
    dp(to2[e]);
    f[u] += f[to2[e]], g[u] += g[to2[e]];
  }
  if (key[u])
    f[u] += g[u], g[u] = 1;
  else
    f[u] += (g[u] > 1), g[u] = (g[u] == 1);
}
int main() {
  n = gi();
  for (int i = 1; i < n; ++i) {
    int u = gi(), v = gi();
    addedge(u, v, i * 2 - 1);
    addedge(v, u, i * 2);
  }
  dfs(1), dfs2(1, 1);
  q = gi();
  int ff = 0;
  while (q--) {
    k = gi();
    for (int i = 1; i <= k; ++i) {
      a[i] = gi();
      vis[a[i]] = q + 1;
      key[a[i]] = true;
    }
    bool flag = true;
    for (int i = 1; flag && i <= k; ++i)
      if (key[fa[a[i]]]) {
        puts("-1");
        for (int j = 1; j <= k; ++j) key[a[j]] = false;
        flag = false;
      }
    if (!flag) continue;
    sort(a + 1, a + 1 + k, cmp);
    for (int i = 1; i < k; ++i) {
      int l = lca(a[i], a[i + 1]);
      if (vis[l] != q + 1) vis[l] = q + 1, a[++k] = l;
    }
    sort(a + 1, a + 1 + k, cmp);
    int tp = 0;
    tot = 0;
    for (int i = 1; i <= k; ++i) {
      while (tp && ed[s[tp]] < st[a[i]]) --tp;
      if (s[tp]) addedge2(s[tp], a[i]);
      s[++tp] = a[i];
    }
    dp(a[1]), printf("%d\n", f[a[1]]);
    for (int i = 1; i <= k; ++i)
      f[a[i]] = g[a[i]] = key[a[i]] = head2[a[i]] = 0;
  }
}
