#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-9;
const int inf = 2000000000;
const long long infLL = 9000000000000000000;
template <typename first, typename second>
ostream &operator<<(ostream &os, const pair<first, second> &p) {
  return os << "(" << p.first << ", " << p.second << ")";
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  os << "{";
  for (auto it = v.begin(); it != v.end(); ++it) {
    if (it != v.begin()) os << ", ";
    os << *it;
  }
  return os << "}";
}
template <typename T>
ostream &operator<<(ostream &os, const set<T> &v) {
  os << "[";
  for (auto it = v.begin(); it != v.end(); ++it) {
    if (it != v.begin()) os << ",";
    os << *it;
  }
  return os << "]";
}
template <typename T>
ostream &operator<<(ostream &os, const multiset<T> &v) {
  os << "[";
  for (auto it = v.begin(); it != v.end(); ++it) {
    if (it != v.begin()) os << ", ";
    os << *it;
  }
  return os << "]";
}
template <typename first, typename second>
ostream &operator<<(ostream &os, const map<first, second> &v) {
  os << "[";
  for (auto it = v.begin(); it != v.end(); ++it) {
    if (it != v.begin()) os << ", ";
    os << it->first << " = " << it->second;
  }
  return os << "]";
}
void faltu() { cerr << '\n'; }
template <typename T>
void faltu(T a[], int n) {
  for (int i = 0; i < n; ++i) cerr << a[i] << ' ';
  cerr << '\n';
}
template <typename T, typename... hello>
void faltu(T arg, const hello &...rest) {
  cerr << arg << ' ';
  faltu(rest...);
}
const int mx = 1e5 + 5;
vector<int> aux[mx];
bool imp[mx];
int n, l;
vector<vector<int>> adjlist;
int timer;
vector<int> tin, tout;
vector<vector<int>> up;
vector<int> depth;
void dfs_lca(int u, int par, int dep) {
  depth[u] = dep;
  tin[u] = ++timer;
  up[u][0] = par;
  for (int i = 1; i <= l; ++i) up[u][i] = up[up[u][i - 1]][i - 1];
  for (auto v : adjlist[u]) {
    if (v != par) dfs_lca(v, u, dep + 1);
  }
  tout[u] = ++timer;
}
bool is_ancestor(int u, int v) {
  return tin[u] <= tin[v] && tout[u] >= tout[v];
}
int lca(int u, int v) {
  if (is_ancestor(u, v)) return u;
  if (is_ancestor(v, u)) return v;
  for (int i = l; i >= 0; --i) {
    if (!is_ancestor(up[u][i], v)) u = up[u][i];
  }
  return up[u][0];
}
int get_dist(int u, int v) {
  return depth[u] + depth[v] - 2 * depth[lca(u, v)];
}
void preprocess(int root) {
  tin.resize(n + 1);
  tout.resize(n + 1);
  depth.resize(n + 1);
  timer = 0;
  l = ceil(log2(n + 1));
  up.assign(n + 1, vector<int>(l + 1));
  dfs_lca(root, root, 0);
}
bool cmp(const int &lhs, const int &rhs) { return tin[lhs] < tin[rhs]; }
int dfs(int u, int par, int &ans) {
  bool ok = 0;
  int cnt = 0;
  for (auto v : aux[u]) {
    if (v == par) continue;
    cnt += dfs(v, u, ans);
    if (imp[u] && imp[v] && get_dist(u, v) == 1) ans = -inf;
  }
  if (imp[u]) {
    ans += cnt;
    return 1;
  }
  if (cnt < 2) return cnt;
  ++ans;
  return 0;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  cin >> n;
  adjlist.resize(n + 1);
  for (int i = 0; i < n - 1; ++i) {
    int u, v;
    cin >> u >> v;
    adjlist[u].push_back(v);
    adjlist[v].push_back(u);
  }
  preprocess(1);
  int q;
  cin >> q;
  while (q--) {
    int k;
    cin >> k;
    vector<int> ul_special;
    vector<int> special;
    for (int i = 0; i < k; ++i) {
      int x;
      cin >> x;
      ul_special.push_back(x);
      special.push_back(x);
    }
    sort(special.begin(), special.end(), cmp);
    for (int i = 1, len = special.size(); i < len; ++i) {
      special.push_back(lca(special[i - 1], special[i]));
    }
    sort(special.begin(), special.end(), cmp);
    special.erase(unique(special.begin(), special.end()), special.end());
    for (auto x : special) {
      aux[x].clear();
      imp[x] = 0;
    }
    for (auto x : ul_special) imp[x] = 1;
    stack<int> st;
    st.push(special[0]);
    for (int i = 1; i < special.size(); ++i) {
      while (!is_ancestor(st.top(), special[i])) st.pop();
      int u = st.top(), v = special[i];
      aux[u].push_back(v);
      aux[v].push_back(u);
      st.push(special[i]);
    }
    int ans = 0;
    dfs(special[0], 0, ans);
    ans = max(ans, -1);
    cout << ans << '\n';
  }
}
