#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pli = pair<ll, int>;
const int INF = 0x3f3f3f3f, N = 1e5 + 5;
const ll LINF = 1e18 + 5;
int n, q, k, id;
int sta[N], top, a[N], ans;
int in[N], out[N], dep[N], fa[N][25], dp[N];
vector<int> G[N], vg[N];
bool tag[N], vis[N];
void dfs(int u) {
  in[u] = ++id;
  for (int i = 1; i <= 20; i++) fa[u][i] = fa[fa[u][i - 1]][i - 1];
  for (int v : G[u]) {
    if (v == fa[u][0]) continue;
    dep[v] = dep[u] + 1;
    fa[v][0] = u;
    dfs(v);
  }
  out[u] = id;
}
int LCA(int x, int y) {
  if (dep[x] > dep[y]) swap(x, y);
  for (int i = 20; i >= 0; i--)
    if (dep[fa[y][i]] >= dep[x]) y = fa[y][i];
  if (x == y) return x;
  for (int i = 20; i >= 0; i--)
    if (fa[x][i] != fa[y][i]) x = fa[x][i], y = fa[y][i];
  return fa[x][0];
}
void dfs2(int u) {
  int cnt = 0;
  for (int v : vg[u]) {
    dfs2(v);
    cnt += tag[v];
    if (tag[u] && tag[v]) ans++;
  }
  if (!tag[u]) {
    if (cnt == 1)
      tag[u] = 1;
    else if (cnt > 1)
      ans++, tag[u] = 0;
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  for (int i = 1; i < n; i++) {
    int u, v;
    cin >> u >> v;
    G[u].push_back(v);
    G[v].push_back(u);
  }
  dep[1] = 1;
  dfs(1);
  cin >> q;
  while (q--) {
    cin >> k;
    int tot = 0;
    for (int i = 1, x; i <= k; i++) {
      cin >> x;
      tag[x] = 1;
      if (!vis[x]) vis[x] = 1, a[++tot] = x;
    }
    bool ok = 1;
    for (int i = 1; i <= tot; i++)
      if (tag[fa[a[i]][0]]) ok = 0;
    if (!ok)
      cout << -1 << '\n';
    else {
      if (!vis[1]) vis[1] = 1, a[++tot] = 1;
      sort(a + 1, a + tot + 1, [&](int x, int y) { return in[x] < in[y]; });
      int tmp = tot;
      for (int i = 1; i < tmp; i++) {
        int lca = LCA(a[i], a[i + 1]);
        if (!vis[lca]) vis[lca] = 1, a[++tot] = lca;
      }
      sort(a + 1, a + tot + 1, [&](int x, int y) { return in[x] < in[y]; });
      sta[top = 1] = 1;
      for (int i = 2; i <= tot; i++) {
        while (in[a[i]] < in[sta[top]] || out[a[i]] > out[sta[top]]) top--;
        vg[sta[top]].push_back(a[i]);
        sta[++top] = a[i];
      }
      dfs2(1);
      cout << ans << '\n';
      ans = 0;
    }
    for (int i = 1; i <= tot; i++) {
      vis[a[i]] = tag[a[i]] = 0;
      vg[a[i]].clear();
    }
  }
  return 0;
}
