#include <bits/stdc++.h>
using namespace std;
const int N = 100005;
int L[N], Pr[N], P[N][22];
vector<int> G[N];
int st[N], ed[N];
void dfs(int node, int pre, int dep) {
  static int timer = 0;
  st[node] = ++timer;
  Pr[node] = pre;
  L[node] = dep;
  for (int i : G[node]) {
    if (i == pre) continue;
    dfs(i, node, dep + 1);
  }
  ed[node] = timer;
}
void init() {
  for (int i = 0; i < N; i++)
    for (int j = 0; j < 22; j++) P[i][j] = 1;
  for (int i = 1; i <= N; i++) P[i][0] = Pr[i];
  for (int j = 1; (1 << j) < N; j++) {
    for (int i = 0; i < N; i++) {
      P[i][j] = P[P[i][j - 1]][j - 1];
    }
  }
}
int query(int p, int q) {
  if (L[p] < L[q]) swap(p, q);
  for (int i = 21; i >= 0; i--) {
    if (L[P[p][i]] >= L[q]) p = P[p][i];
  }
  if (p == q) return p;
  for (int i = 21; i >= 0; i--) {
    if (P[p][i] != P[q][i]) {
      p = P[p][i];
      q = P[q][i];
    }
  }
  return Pr[p];
}
int isanc(int u, int v) { return (st[u] <= st[v]) && (ed[v] <= ed[u]); }
int n, q;
vector<int> Tree[N];
int imp[N];
vector<int> build_auxiliary_tree(vector<int>& nodes) {
  nodes.push_back(1);
  set<int> distinctNodes;
  for (int i = 0; i < nodes.size(); i++) {
    distinctNodes.insert(nodes[i]);
    if (Pr[nodes[i]] > 0) distinctNodes.insert(Pr[nodes[i]]);
  }
  vector<int> v;
  for (int i : distinctNodes) v.push_back(i);
  sort(v.begin(), v.end(), [](int x, int y) { return st[x] < st[y]; });
  int sz = v.size();
  for (int i = 1; i < sz; i++) {
    v.push_back(query(v[i - 1], v[i]));
  }
  sort(v.begin(), v.end());
  v.erase(unique(v.begin(), v.end()), v.end());
  sort(v.begin(), v.end(), [](int x, int y) { return st[x] < st[y]; });
  stack<int> stk;
  stk.push(v[0]);
  for (int i = 1; i < v.size(); i++) {
    while (!isanc(stk.top(), v[i])) stk.pop();
    Tree[stk.top()].push_back(v[i]);
    stk.push(v[i]);
  }
  return v;
}
int ans;
int DFS(int node) {
  if (imp[node] == 0) {
    int s = 0;
    for (int i : Tree[node]) {
      s += DFS(i);
    }
    if (s > 1) {
      ans++;
      return 0;
    }
    return s;
  } else {
    int s = 0;
    for (int i : Tree[node]) {
      int x = DFS(i);
      s += x;
      if (imp[i]) ans = -1e9;
    }
    ans += s;
    return 1;
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(nullptr);
  cin >> n;
  for (int i = 1; i <= n - 1; i++) {
    int u, v;
    cin >> u >> v;
    G[u].push_back(v);
    G[v].push_back(u);
  }
  dfs(1, 1, 0);
  init();
  cin >> q;
  for (int i = 1; i <= q; i++) {
    int k;
    cin >> k;
    vector<int> nodes;
    for (int j = 1; j <= k; j++) {
      int c;
      cin >> c;
      nodes.push_back(c);
      imp[c] = 1;
    }
    vector<int> v = build_auxiliary_tree(nodes);
    ans = 0;
    DFS(1);
    if (ans < 0)
      cout << -1 << "\n";
    else
      cout << ans << "\n";
    for (int i : v) Tree[i].clear();
    for (int i : nodes) imp[i] = 0;
  }
}
