#include <bits/stdc++.h>
using namespace std;
const int N = 100010;
vector<int> G[N];
bool imp[N], check[N];
int n, q, par[N][20], start[N], finish[N], d[N];
int cur, ans;
void build(int u) {
  start[u] = ++cur;
  for (int i = (int)(0); i <= (int)(G[u].size() - 1); i++) {
    int v = G[u][i];
    if (start[v]) continue;
    par[v][0] = u;
    d[v] = d[u] + 1;
    build(v);
  }
  finish[u] = cur;
}
int lca(int u, int v) {
  if (d[u] < d[v]) swap(u, v);
  for (int i = (int)(19); i >= (int)(0); i--)
    if (d[par[u][i]] >= d[v]) u = par[u][i];
  for (int i = (int)(19); i >= (int)(0); i--)
    if (par[u][i] != par[v][i]) u = par[u][i], v = par[v][i];
  return u == v ? u : par[u][0];
}
bool cmp(int u, int v) { return start[u] < start[v]; }
void dfs(int u) {
  int cnt = 0;
  for (int i = (int)(0); i <= (int)(G[u].size() - 1); i++) {
    int v = G[u][i];
    dfs(v);
    cnt += check[v];
  }
  if (imp[u])
    check[u] = 1, ans += cnt;
  else {
    if (cnt >= 2)
      ans++, check[u] = 0;
    else if (cnt == 1)
      check[u] = 1;
    else
      check[u] = 0;
  }
}
void solve() {
  int k;
  cin >> k;
  vector<int> v;
  ans = 0;
  for (int i = (int)(1); i <= (int)(k); i++) {
    int x;
    cin >> x;
    imp[x] = 1;
    v.push_back(x);
  }
  sort(v.begin(), v.end(), cmp);
  bool ok = 1;
  for (int i = (int)(1); i <= (int)(k - 1); i++) {
    v.push_back(lca(v[i], v[i - 1]));
    if (imp[par[v[i]][0]]) ok = 0;
  }
  if (!ok) {
    for (int i = (int)(0); i <= (int)(v.size() - 1); i++) imp[v[i]] = 0;
    printf("-1\n");
    return;
  }
  sort(v.begin(), v.end(), cmp);
  v.resize(distance(v.begin(), unique(v.begin(), v.end())));
  for (int i = (int)(1); i <= (int)(v.size() - 1); i++) {
    int p = lca(v[i], v[i - 1]);
    G[p].push_back(v[i]);
  }
  dfs(v[0]);
  printf("%d\n", ans);
  for (int i = (int)(0); i <= (int)(v.size() - 1); i++)
    G[v[i]].clear(), imp[v[i]] = 0, check[v[i]] = 0;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  for (int i = (int)(1); i <= (int)(n - 1); i++) {
    int u, v;
    cin >> u >> v;
    G[u].push_back(v);
    G[v].push_back(u);
  }
  par[1][0] = 1;
  build(1);
  for (int i = (int)(1); i <= (int)(19); i++)
    for (int j = (int)(1); j <= (int)(n); j++)
      par[j][i] = par[par[j][i - 1]][i - 1];
  for (int i = (int)(1); i <= (int)(n); i++) G[i].clear();
  cin >> q;
  while (q--) {
    solve();
  }
}
