#include <bits/stdc++.h>
using namespace std;
int cnt, nrq, k, v[100005];
bool hasImp[100005];
int n, t[100005], lvl[100005], dad[100005][18];
vector<int> G[100005], G2[100005];
int imp[100005], sol;
set<pair<int, int> > e;
void DFS(int u, int p) {
  t[u] = (++cnt);
  lvl[u] = lvl[p] + 1;
  int x = p;
  for (int i = 0; i < 18; ++i) {
    dad[u][i] = x;
    x = dad[x][i];
  }
  for (auto x : G[u])
    if (x != p) DFS(x, u);
}
void DFS2(int u) {
  int cnt = 0;
  for (auto x : G2[u]) {
    DFS2(x);
    if (hasImp[x]) ++cnt;
  }
  if (imp[u] == 2) {
    hasImp[u] = 1;
    if (cnt) sol += cnt;
  } else {
    if (cnt > 1) {
      ++sol;
      hasImp[u] = 0;
    } else if (cnt == 1)
      hasImp[u] = 1;
    else
      hasImp[u] = 0;
  }
}
int lca(int x, int y) {
  if (lvl[x] > lvl[y]) swap(x, y);
  for (int i = 18 - 1; i >= 0; --i)
    if (lvl[y] - (1 << i) >= lvl[x]) y = dad[y][i];
  if (x == y) return x;
  for (int i = 18 - 1; i >= 0; --i)
    if (dad[x][i] != dad[y][i]) {
      x = dad[x][i];
      y = dad[y][i];
    }
  return dad[x][0];
}
bool Comp(int a, int b) { return t[a] < t[b]; }
void clearThings() {
  for (int i = 1; i <= k; ++i) {
    imp[v[i]] = 0;
    G2[v[i]].clear();
  }
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i < n; ++i) {
    int x, y;
    scanf("%d %d", &x, &y);
    G[x].push_back(y);
    G[y].push_back(x);
    e.insert(make_pair(x, y));
    e.insert(make_pair(y, x));
  }
  DFS(1, 0);
  scanf("%d", &nrq);
  while (nrq--) {
    scanf("%d", &k);
    for (int i = 1; i <= k; ++i) {
      scanf("%d", &v[i]);
      imp[v[i]] = 2;
    }
    sort(v + 1, v + k + 1, Comp);
    int auxk = k;
    for (int i = 1; i < auxk; ++i) {
      int x = lca(v[i], v[i + 1]);
      if (!imp[x]) {
        imp[x] = 1;
        v[++k] = x;
      }
    }
    sol = 0;
    sort(v + 1, v + k + 1, Comp);
    vector<int> st;
    st.push_back(v[1]);
    for (int i = 2; i <= k; ++i) {
      while (!st.empty() && lca(st.back(), v[i]) != st.back()) st.pop_back();
      assert(!st.empty());
      if (imp[st.back()] == 2 && imp[v[i]] == 2 &&
          e.count(make_pair(st.back(), v[i]))) {
        sol = -1;
        break;
      }
      G2[st.back()].push_back(v[i]);
      st.push_back(v[i]);
    }
    if (sol != -1) DFS2(v[1]);
    printf("%d\n", sol);
    clearThings();
  }
  return 0;
}
