#include <bits/stdc++.h>
using namespace std;
long long dfn[1000000], siz[1000000], dep[1000000], to[1000000], nxt[1000000],
    head[1000000], w[1000000], cnt, tot;
long long son[1000000], top[1000000], z[1000000], mn[1000000], a[1000000],
    f[1000000], b[1000000], fl[1000000], tt, n, m, k, inf = 999999999;
vector<long long> v[1000000];
bool cmp(long long x, long long y) { return dfn[x] < dfn[y]; }
void add(long long x, long long y) {
  to[++cnt] = y;
  nxt[cnt] = head[x];
  head[x] = cnt;
}
void dfs1(long long x, long long fa) {
  dfn[x] = ++tot;
  siz[x] = 1;
  dep[x] = dep[fa] + 1;
  f[x] = fa;
  for (long long i = head[x]; i; i = nxt[i]) {
    if (to[i] == fa) continue;
    dfs1(to[i], x);
    siz[x] += siz[to[i]];
    if (siz[son[x]] < siz[to[i]]) son[x] = to[i];
  }
}
void dfs2(long long x, long long fa) {
  top[x] = fa;
  if (son[x]) dfs2(son[x], fa);
  for (long long i = head[x]; i; i = nxt[i]) {
    if (to[i] == f[x] || to[i] == son[x]) continue;
    dfs2(to[i], to[i]);
  }
}
long long lca(long long x, long long y) {
  while (top[x] != top[y])
    dep[top[x]] > dep[top[y]] ? x = f[top[x]] : y = f[top[y]];
  return dep[x] > dep[y] ? y : x;
}
long long dp(long long x) {
  long long ans = 0, sum = 0;
  for (auto u : v[x]) ans += dp(u), sum += b[u];
  if (fl[x])
    b[x] = 1, ans += sum;
  else if (sum > 1)
    b[x] = 0, ans++;
  else
    b[x] = sum;
  return v[x].clear(), ans;
}
long long build() {
  for (long long i = 1; i <= k; i++)
    if (fl[f[a[i]]]) return -1;
  sort(a + 1, a + k + 1, cmp);
  for (long long i = 1; i <= k; i++) {
    if (!tt) {
      z[++tt] = a[i];
      continue;
    }
    long long la = lca(a[i], z[tt]);
    while (dep[z[tt - 1]] >= dep[la]) v[z[tt - 1]].push_back(z[tt]), tt--;
    if (la != z[tt]) v[la].push_back(z[tt]), z[tt] = la;
    z[++tt] = a[i];
  }
  while (tt) v[z[tt - 1]].push_back(z[tt]), tt--;
  return dp(z[1]);
}
signed main() {
  long long x, y, z;
  scanf("%lld", &n);
  for (long long i = 1; i < n; i++)
    scanf("%lld%lld", &x, &y), add(x, y), add(y, x);
  dfs1(1, 0);
  dfs2(1, 1);
  scanf("%lld", &m);
  while (m--) {
    scanf("%lld", &k);
    for (long long i = 1; i <= k; i++) scanf("%lld", &a[i]), fl[a[i]] = 1;
    printf("%lld\n", build());
    for (long long i = 1; i <= k; i++) fl[a[i]] = 0;
  }
  return 0;
}
