#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int inf = 1e9;
const int N = 1e5 + 5;
int add(int x, int y) { return (1ll * x + 1ll * y) % mod; }
int del(int x, int y) { return ((1ll * x - 1ll * y) % mod + mod) % mod; }
int mul(int x, int y) { return (1ll * x * 1ll * y) % mod; }
int n, q, st[N], f[N], cnt, par[N][25], dp[N][2];
bool vis[N], in[N];
vector<int> graph[N], gr[N];
void dfs(int u, int p) {
  st[u] = ++cnt;
  for (int i = 0; i < graph[u].size(); i++) {
    int v = graph[u][i];
    if (v == p) continue;
    f[v] = f[u] + 1;
    par[v][0] = u;
    dfs(v, u);
  }
}
void preplca() {
  for (int j = 1; j <= 20; j++) {
    for (int i = 1; i <= n; i++) par[i][j] = par[par[i][j - 1]][j - 1];
  }
}
int findlca(int u, int v) {
  if (f[u] < f[v]) swap(u, v);
  for (int i = 20; i >= 0; i--) {
    if (par[u][i] != 0 && f[par[u][i]] >= f[v]) u = par[u][i];
  }
  if (u == v) return u;
  for (int i = 20; i >= 0; i--) {
    if (par[u][i] != 0 && par[v][i] != 0 && par[u][i] != par[v][i]) {
      u = par[u][i];
      v = par[v][i];
    }
  }
  return par[u][0];
}
vector<pair<int, int> > vec;
stack<int> sta;
void solve(int u, int p) {
  for (int i = 0; i < gr[u].size(); i++) {
    int v = gr[u][i];
    if (v == p) continue;
    solve(v, u);
  }
  if (gr[u].size() == 1 && vis[u] == 1 && u != vec[0].second) {
    dp[u][0] = inf;
    dp[u][1] = 0;
    return;
  }
  if (vis[u] == 1) {
    int lmao = 0;
    for (int i = 0; i < gr[u].size(); i++) {
      int v = gr[u][i];
      if (v == p) continue;
      if (f[v] - f[u] >= 2)
        lmao += min(dp[v][0], dp[v][1] + 1);
      else
        lmao += dp[v][0];
      lmao = min(lmao, inf);
    }
    dp[u][0] = inf;
    dp[u][1] = lmao;
  } else {
    int lmao = 0, lmao3 = 0;
    for (int i = 0; i < gr[u].size(); i++) {
      int v = gr[u][i];
      if (v == p) continue;
      if (f[v] - f[u] >= 2)
        lmao += min(dp[v][0], dp[v][1] + 1);
      else
        lmao += dp[v][0];
      lmao3 += min(dp[v][0], dp[v][1]);
      lmao3 = min(lmao3, inf);
      lmao = min(lmao, inf);
    }
    dp[u][0] = min(lmao, lmao3 + 1);
    int res0 = 0, res1 = inf;
    for (int i = 0; i < gr[u].size(); i++) {
      int v = gr[u][i];
      if (v == p) continue;
      int lmao0, lmao1;
      lmao0 = res0 + dp[v][0];
      lmao1 = min(res0 + dp[v][1], res1 + dp[v][0]);
      if (f[v] - f[u] >= 2) {
        lmao0 = min(lmao0, res0 + dp[v][1] + 1);
        lmao1 = min(lmao1, res1 + dp[v][1] + 1);
      }
      res0 = min(lmao0, inf);
      res1 = min(lmao1, inf);
    }
    dp[u][1] = min(res1, inf);
    dp[u][0] = min(dp[u][0], inf);
  }
}
int main() {
  cin.tie(0), ios::sync_with_stdio(0);
  cin >> n;
  for (int i = 1; i <= n - 1; i++) {
    int u, v;
    cin >> u >> v;
    graph[u].push_back(v);
    graph[v].push_back(u);
  }
  dfs(1, 1);
  preplca();
  cin >> q;
  while (q--) {
    int num;
    cin >> num;
    for (int i = 1; i <= num; i++) {
      int x;
      cin >> x;
      vis[x] = 1;
      in[x] = 1;
      vec.push_back({st[x], x});
    }
    sort(vec.begin(), vec.end());
    for (int i = 0; i < vec.size() - 1; i++) {
      int lca = findlca(vec[i].second, vec[i + 1].second);
      if (!in[lca]) vec.push_back({st[lca], lca});
      in[lca] = 1;
    }
    sort(vec.begin(), vec.end());
    for (int i = vec.size() - 1; i >= 0; i--) {
      while (!sta.empty() &&
             findlca(vec[i].second, sta.top()) == vec[i].second) {
        gr[sta.top()].push_back(vec[i].second);
        gr[vec[i].second].push_back(sta.top());
        sta.pop();
      }
      sta.push(vec[i].second);
    }
    solve(vec[0].second, vec[0].second);
    int mn = min(dp[vec[0].second][0], dp[vec[0].second][1]);
    if (mn >= inf)
      cout << -1 << "\n";
    else
      cout << mn << "\n";
    while (!sta.empty()) sta.pop();
    for (int i = 0; i < vec.size(); i++) {
      in[vec[i].second] = 0;
      vis[vec[i].second] = 0;
      gr[vec[i].second].clear();
    }
    vec.clear();
  }
}
