#include <bits/stdc++.h>
using namespace std;
const int INF = (int)1e9;
const int N = 100 * 1000 + 10;
const int L = 20;
vector<int> g[N];
int tin[N];
int tout[N];
int go[N][L];
int rev[4 * N];
int timer;
bool was[N];
long long dp[N][2];
int par[N];
vector<int> tree[N];
set<int> important;
set<int> seen;
void dfs(int v, int p) {
  was[v] = true;
  tin[v] = timer++;
  rev[tin[v]] = v;
  go[v][0] = p;
  for (int l = 1; l < L; l++) go[v][l] = go[go[v][l - 1]][l - 1];
  for (int to : g[v])
    if (!was[to]) dfs(to, v);
  tout[v] = timer++;
}
struct Bit {
  vector<int> f;
  Bit(int n) { f.assign(n, 0); }
  void upd(int i, int delta) {
    for (; i < f.size(); i = (i | (i + 1))) f[i] += delta;
  }
  int get(int i) {
    int res = 0;
    for (; i >= 0; i = (i & (i + 1)) - 1) res += f[i];
    return res;
  }
  int get(int l, int r) { return get(r) - get(l - 1); }
};
Bit all(4 * N);
void calc(int v) {
  long long sum0 = 0;
  long long sum1 = 0;
  long long max_delta = 0;
  for (int to : tree[v]) {
    calc(to);
    if (go[to][0] != v) dp[to][0] = min(dp[to][0], dp[to][1] + 1);
    sum0 += dp[to][0];
    sum1 += dp[to][1];
    max_delta = max(max_delta, dp[to][0] - dp[to][1]);
  }
  if (important.find(v) == important.end()) {
    dp[v][0] = min(sum0, sum1 + 1);
    dp[v][1] = sum0 - max_delta;
  } else {
    dp[v][0] = INF;
    dp[v][1] = sum0;
  }
  dp[v][0] = min(dp[v][0], INF + 0ll);
  dp[v][1] = min(dp[v][1], dp[v][0]);
}
int solve(const vector<int>& a) {
  for (int x : a) {
    important.insert(x);
  }
  for (int x : a)
    if (go[x][0] != x && important.count(go[x][0]) != 0) {
      seen.clear();
      important.clear();
      return -1;
    }
  int root = a[0];
  all.upd(tin[a[0]], 1);
  seen.insert(a[0]);
  for (int i = 1; i < a.size(); i++) {
    int x = a[i];
    if (seen.find(x) != seen.end()) continue;
    int y = x;
    for (int l = L - 1; l >= 0; l--) {
      int lo = go[y][l];
      if (all.get(tin[lo], tout[lo]) == 0) y = lo;
    }
    if (all.get(tin[y], tout[y]) == 0) y = go[y][0];
    if (seen.find(y) == seen.end()) {
      int lo = tin[y];
      int hi = tout[y];
      while (hi - lo > 1) {
        int m = (lo + hi) / 2;
        if (all.get(tin[y], m) == 0)
          lo = m;
        else
          hi = m;
      }
      int split = rev[hi];
      par[y] = par[split];
      par[split] = y;
      if (par[y] == -1) root = y;
      seen.insert(y);
      all.upd(tin[y], 1);
    }
    if (x != y) {
      par[x] = y;
      seen.insert(x);
      all.upd(tin[x], 1);
    }
  }
  for (int x : seen)
    if (par[x] != -1) tree[par[x]].push_back(x);
  calc(root);
  for (int x : seen) {
    all.upd(tin[x], -1);
    tree[x].clear();
    par[x] = -1;
  }
  seen.clear();
  important.clear();
  return min(dp[root][0], dp[root][1]);
}
int main() {
  ios_base::sync_with_stdio(0);
  fill(par, par + N, -1);
  int n;
  cin >> n;
  for (int i = 0; i < n - 1; i++) {
    int a, b;
    cin >> a >> b;
    --a;
    --b;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  dfs(0, 0);
  int q;
  cin >> q;
  while (q--) {
    int s;
    cin >> s;
    vector<int> v(s);
    for (int i = 0; i < s; i++) {
      cin >> v[i];
      v[i]--;
    }
    cout << solve(v) << "\n";
  }
  return 0;
}
