#include <bits/stdc++.h>
using namespace std;
const int maxn = 100010;
const int maxc = 20;
const int oo = 0x3f3f3f3f;
inline void chkmin(int &a, int b) {
  if (a > b) a = b;
}
vector<int> con[maxn];
vector<pair<int, int> > adj[maxn];
int n, q, pt[2 * maxn], anc[maxn][maxc], par[maxn], dp[maxn], vis[maxn],
    flag[maxn];
int nst[maxn], nen[maxn], st[maxn], en[maxn];
int T, root[maxn], nr;
int ff[maxn][2];
void dfs(int u) {
  vis[u] = 1;
  st[u] = ++T;
  for (int v : con[u])
    if (!vis[v]) par[v] = u, dp[v] = dp[u] + 1, dfs(v);
  en[u] = T;
}
void init() {
  for (int i = 1; i <= n; i++) anc[i][0] = par[i];
  for (int i = 1; i < maxc; i++)
    for (int j = 1; j <= n; j++) anc[j][i] = anc[anc[j][i - 1]][i - 1];
}
int LCA(int u, int v) {
  if (dp[u] < dp[v]) swap(u, v);
  for (int i = maxc - 1; i >= 0; i--)
    if (dp[anc[u][i]] >= dp[v]) u = anc[u][i];
  if (u == v) return u;
  for (int i = maxc - 1; i >= 0; i--)
    if (anc[u][i] != anc[v][i]) u = anc[u][i], v = anc[v][i];
  return anc[u][0];
}
int cmp(int a, int b) { return st[a] < st[b]; }
int f(int u, int d) {
  if (ff[u][d] != -1) return ff[u][d];
  if (adj[u].empty()) {
    if (d == 1) {
      if (flag[pt[u]] == T) return ff[u][d] = 0;
      return ff[u][d] = n;
    }
    if (flag[pt[u]] == T) return ff[u][d] = n;
    return ff[u][d] = 0;
  }
  if (d == 0) {
    if (flag[pt[u]] == T) return ff[u][d] = n;
    ff[u][d] = 0;
    int fl = 0;
    for (auto v : adj[u]) {
      if (f(v.first, 0) <= f(v.first, 1))
        ff[u][d] += f(v.first, 0);
      else
        ff[u][d] += f(v.first, 1), fl = 1;
    }
    if (fl) ff[u][d]++;
    return ff[u][d];
  }
  if (flag[pt[u]] == T) {
    ff[u][d] = 0;
    for (auto v : adj[u])
      if (!v.second)
        ff[u][d] += f(v.first, 0);
      else
        ff[u][d] += min(f(v.first, 0), f(v.first, 1) + 1);
    return ff[u][d];
  }
  long long sum = 0;
  for (auto v : adj[u]) {
    if (v.second)
      sum += min(f(v.first, 0), f(v.first, 1) + 1);
    else
      sum += f(v.first, 0);
  }
  ff[u][d] = n * n;
  for (auto v : adj[u]) {
    long long rest;
    if (v.second)
      rest = sum - min(f(v.first, 0), f(v.first, 1) + 1);
    else
      rest = sum - f(v.first, 0);
    rest += f(v.first, 1);
    chkmin(ff[u][d], rest);
  }
  if (ff[u][d] >= n) return ff[u][d] = n;
  return ff[u][d];
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i < n; i++) {
    int a, b;
    scanf("%d%d", &a, &b);
    con[a].push_back(b);
    con[b].push_back(a);
  }
  dp[1] = 1;
  dfs(1);
  init();
  T = 0;
  scanf("%d", &q);
  while (q--) {
    ++T;
    int cn;
    scanf("%d", &cn);
    for (int i = 0; i < cn; i++) scanf("%d", &pt[i]), flag[pt[i]] = T;
    int fl = 0;
    for (int i = 0; i < cn; i++)
      for (auto j : con[pt[i]])
        if (flag[j] == T) {
          fl = 1;
          break;
        }
    if (fl) {
      puts("-1");
      continue;
    }
    sort(pt, pt + cn, cmp);
    for (int i = 0; i < cn - 1; i++) pt[i + cn] = LCA(pt[i], pt[i + 1]);
    cn = cn * 2 - 1;
    sort(pt, pt + cn, cmp);
    cn = unique(pt, pt + cn) - pt;
    for (int i = 0; i < cn; i++) nst[i] = st[pt[i]], nen[i] = en[pt[i]];
    for (int i = 0; i < cn; i++) adj[i].clear();
    nr = 0;
    root[nr++] = 0;
    for (int i = 1; i < cn; i++) {
      while (nr--) {
        if (nst[root[nr]] <= nst[i] && nen[i] <= nen[root[nr]]) {
          par[i] = root[nr];
          break;
        }
      }
      root[++nr] = i;
      nr++;
    }
    for (int i = 1; i < cn; i++)
      adj[par[i]].push_back(
          make_pair(i, dp[pt[i]] - dp[pt[par[i]]] >= 2 ? 1 : 0));
    for (int i = 0; i < cn; i++) ff[i][0] = ff[i][1] = -1;
    printf("%d\n", min(f(0, 0), f(0, 1)));
  }
  return 0;
}
