#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 20;
vector<int> graph[maxn], auxgraph[maxn], vec;
int n, q, par[maxn][20], h[maxn], k, ans, root, st[maxn], fn[maxn], timee;
bool mark[maxn], bs, dp[maxn];
int dfsl(int i, int p) {
  st[i] = fn[i] = timee++;
  par[i][0] = p;
  for (int j = 1; j < 20; j++) par[i][j] = par[par[i][j - 1]][j - 1];
  for (int u : graph[i])
    if (u != p) h[u] = h[i] + 1, fn[i] = dfsl(u, i);
  return fn[i];
}
int calc(int i, int p) {
  for (int j = 0; j < 20; j++)
    if (p & (1 << j)) i = par[i][j];
  return i;
}
int lca(int u, int v) {
  if (h[u] < h[v]) swap(u, v);
  u = calc(u, h[u] - h[v]);
  if (u == v) return u;
  for (int i = 19; i > -1; i--)
    if (par[u][i] != par[v][i]) u = par[u][i], v = par[v][i];
  return par[u][0];
}
bool comp(int a, int b) { return st[a] < st[b]; }
void auxiliary() {
  sort(vec.begin(), vec.end(), comp);
  for (int i = 0; i < k - 1; i++) vec.push_back(lca(vec[i], vec[i + 1]));
  sort(vec.begin(), vec.end(), comp);
  vec.resize(unique(vec.begin(), vec.end()) - vec.begin());
  stack<int> s;
  s.push(root = *vec.begin());
  for (int i = 1; i < vec.size(); i++) {
    while (st[s.top()] > st[vec[i]] || fn[s.top()] < st[vec[i]]) s.pop();
    auxgraph[s.top()].push_back(vec[i]);
    s.push(vec[i]);
  }
}
int dfs(int i) {
  int res = 0;
  for (int u : auxgraph[i]) res += dfs(u);
  if (dp[i])
    ans += res;
  else if (res > 1)
    ans += 1;
  else if (res)
    dp[i] = 1;
  return dp[i];
}
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n;
  for (int i = 1, u, v; i < n; i++) {
    cin >> u >> v;
    graph[u].push_back(v);
    graph[v].push_back(u);
  }
  dfsl(1, 0);
  cin >> q;
  while (q--) {
    cin >> k;
    for (int i = 0, u; i < k; i++) {
      cin >> u;
      vec.push_back(u);
      dp[u] = mark[u] = 1;
    }
    for (int i : vec)
      if (mark[par[i][0]]) bs = 1;
    auxiliary();
    dfs(root);
    if (bs)
      cout << -1 << '\n';
    else
      cout << ans << '\n';
    for (int i : vec) mark[i] = 0, dp[i] = 0, auxgraph[i].clear();
    ans = 0, bs = 0;
    vec.clear();
  }
}
