#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 20;
int n, clk = 0, dfn[MAXN], depth[MAXN], bfa[MAXN][18];
list<int> g[MAXN];
void link(int u, int v) {
  g[u].push_back(v);
  g[v].push_back(u);
}
void build_tree(int u = 1, int fa = 0) {
  dfn[u] = ++clk;
  depth[u] = depth[fa] + 1;
  bfa[u][0] = fa;
  for (int i = 1; (1 << i) <= depth[u]; i++)
    bfa[u][i] = bfa[bfa[u][i - 1]][i - 1];
  for (int v : g[u])
    if (v != fa) build_tree(v, u);
}
int lca(int u, int v) {
  if (depth[u] > depth[v]) swap(u, v);
  for (int i = 17; i >= 0; i--)
    if ((depth[v] - depth[u]) & (1 << i)) v = bfa[v][i];
  if (u == v) return u;
  for (int i = 17; i >= 0; i--)
    if (bfa[u][i] != bfa[v][i]) {
      u = bfa[u][i];
      v = bfa[v][i];
    }
  return bfa[u][0];
}
int m, crit[MAXN], vis[MAXN], siz[MAXN], d[MAXN];
void build_virtual() {
  deque<int> st;
  st.push_front(1);
  g[1].clear();
  for (int i = 0; i < m; i++) {
    if (crit[i] == 1) continue;
    int anc = lca(crit[i], st[0]);
    if (anc != st[0]) {
      while (dfn[st[1]] > dfn[anc]) {
        link(st[0], st[1]);
        st.pop_front();
      }
      if (anc != st[1]) {
        g[anc].clear();
        link(anc, st[0]);
        st.pop_front();
        st.push_front(anc);
      } else {
        link(anc, st[0]);
        st.pop_front();
      }
    }
    g[crit[i]].clear();
    st.push_front(crit[i]);
  }
  while (st.size() > 1) {
    link(st[0], st[1]);
    st.pop_front();
  }
}
int dp(int u, int fa) {
  d[u] = siz[u] = 0;
  for (auto v : g[u]) {
    if (v == fa) continue;
    dp(v, u);
    d[u] += d[v];
    siz[u] += siz[v];
  }
  if (vis[u]) {
    d[u] += siz[u];
    siz[u] = 1;
  } else if (siz[u] > 1) {
    d[u]++;
    siz[u] = 0;
  }
  return d[u];
}
void solve() {
  cin >> m;
  for (int i = 0; i < m; i++) {
    cin >> crit[i];
    vis[crit[i]] = 1;
  }
  for (int i = 0; i < m; i++)
    if (vis[bfa[crit[i]][0]]) {
      for (int j = 0; j < m; j++) vis[crit[j]] = 0;
      cout << "-1\n";
      return;
    }
  sort(crit, crit + m, [](int a, int b) { return dfn[a] < dfn[b]; });
  build_virtual();
  cout << dp(1, 0) << "\n";
  for (int i = 0; i < m; i++) vis[crit[i]] = 0;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cin >> n;
  for (int i = 1; i < n; i++) {
    int u, v;
    cin >> u >> v;
    link(u, v);
  }
  build_tree();
  int q;
  cin >> q;
  while (q--) solve();
}
