#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 10;
vector<int> g[N], g2[N];
int dep[N], par[N][25], dfn[N], ncnt;
void dfs(int f, int u) {
  par[u][0] = f;
  dep[u] = dep[f] + 1;
  dfn[u] = ++ncnt;
  for (int i = 1; i <= 20; i++) par[u][i] = par[par[u][i - 1]][i - 1];
  for (int i = 0, sz = g[u].size(); i < sz; i++) {
    int v = g[u][i];
    if (v != f) dfs(u, v);
  }
}
int Lca(int x, int y) {
  if (dep[x] < dep[y]) swap(x, y);
  int dx = dep[x] - dep[y];
  for (int i = 0; (1 << i) <= dx; i++) {
    if ((1 << i) & dx) x = par[x][i];
  }
  for (int i = 20; i >= 0; i--)
    if (par[x][i] != par[y][i]) {
      x = par[x][i], y = par[y][i];
    }
  if (x != y) x = par[x][0];
  return x;
}
int a[N], sta[N], rec[N], vis[N], val[N], tp;
void Add_Rec(int u, int v) {
  rec[++rec[0]] = u;
  rec[++rec[0]] = v;
}
bool cmp(int x, int y) { return dfn[x] < dfn[y]; }
void Insert(int x) {
  if (!tp) {
    sta[++tp] = x;
    return;
  }
  int lca = Lca(sta[tp], x);
  while (tp > 1 && dep[lca] < dep[sta[tp - 1]]) {
    Add_Rec(sta[tp - 1], sta[tp]);
    g2[sta[tp - 1]].push_back(sta[tp]);
    tp--;
  }
  if (dep[lca] < dep[sta[tp]]) {
    g2[lca].push_back(sta[tp]), Add_Rec(lca, sta[tp]), tp--;
  }
  if (!tp || sta[tp] != lca) sta[++tp] = lca;
  sta[++tp] = x;
}
int ans;
void init(int n) {
  ans = tp = 0;
  for (int i = 1; i <= n; i++) {
    val[a[i]] = 0;
    vis[par[a[i]][0]] = 0;
  }
  for (int i = 1; i <= rec[0]; i++) {
    g2[rec[i]].clear();
    val[rec[i]] = 0;
  }
  rec[0] = 0;
}
void solve(int u) {
  if (val[u]) {
    for (auto v : g2[u]) {
      solve(v);
      if (val[v]) {
        val[v] = 0;
        ans++;
      }
    }
  } else {
    for (auto v : g2[u]) {
      solve(v);
      val[u] += val[v];
      val[v] = 0;
    }
    if (val[u] > 1) {
      val[u] = 0;
      ans++;
    }
  }
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1, u, v; i < n; i++) {
    scanf("%d%d", &u, &v);
    g[u].push_back(v);
    g[v].push_back(u);
  }
  dfs(0, 1);
  int m;
  scanf("%d", &m);
  for (int i = 1, p; i <= m; i++) {
    scanf("%d", &p);
    for (int j = 1, x; j <= p; j++) {
      scanf("%d", &a[j]);
      vis[par[a[j]][0]] = 1;
      val[a[j]] = 1;
    }
    for (int j = 1; j <= p; j++) {
      if (vis[a[j]]) {
        printf("-1\n");
        goto here;
      }
    }
    sort(a + 1, a + 1 + p, cmp);
    if (a[1] != 1) sta[++tp] = 1;
    for (int j = 1; j <= p; j++) {
      Insert(a[j]);
    }
    while (tp > 1) {
      g2[sta[tp - 1]].push_back(sta[tp]), Add_Rec(sta[tp - 1], sta[tp]), tp--;
    }
    solve(1);
    printf("%d\n", ans);
  here:;
    init(p);
  }
  return 0;
}
