#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10, lg = 30;
int u, v, n, q, t, h[N], par[N][lg + 10], s, k[N], w, st[N], dp[N], mk[N], nu,
    III[N];
vector<int> G[N], child[N];
vector<pair<int, int> > lc, vc;
int fpar[N];
bool vis[N], isv[N], mark[N], flag;
void dfs(int x, int p) {
  par[x][0] = p;
  for (int i = 1; i <= lg; i++) par[x][i] = par[par[x][i - 1]][i - 1];
  st[x] = t++;
  for (auto i : G[x]) {
    if (i == p) continue;
    h[i] = h[x] + 1;
    dfs(i, x);
  }
}
int get_par(int x, int y) {
  for (int i = 0; i <= lg; i++)
    if ((y >> i) & 1) x = par[x][i];
  return x;
}
int lca(int x, int y) {
  if (h[x] > h[y]) swap(x, y);
  y = get_par(y, h[y] - h[x]);
  if (x == y) return x;
  for (int i = lg; i >= 0; i--) {
    if (par[x][i] != par[y][i]) {
      x = par[x][i];
      y = par[y][i];
    }
  }
  return par[x][0];
}
void dfs2(int x) {
  vis[x] = 1;
  dp[x] = mark[x];
  for (auto i : child[x]) {
    if (!vis[i]) {
      dfs2(i);
      dp[x] += dp[i];
    }
  }
  if (dp[x] < 0) dp[x] = 0;
}
void dfs3(int x) {
  vis[x] = 1;
  for (auto i : child[x]) {
    if (!vis[i]) {
      dfs3(i);
      if (mark[i] && mark[x]) {
        nu++;
        mk[x]++;
      }
      mk[x] += mk[i];
    }
  }
  dp[x] -= mk[x];
  if (!mark[x]) {
    if (dp[x] > 1 || (dp[x] == 1 && (fpar[x] != -1 && mark[fpar[x]]))) {
      nu++;
      mk[x] += dp[x];
    }
  }
}
int is_ancle(int x, int y) {
  int d = lca(x, y);
  return d;
}
void trash() {
  for (auto i : lc) {
    vis[i.second] = 0;
    mark[i.second] = 0;
    dp[i.second] = 0;
    mk[i.second] = 0;
    fpar[i.second] = 0;
    isv[i.second] = 0;
    child[i.second].clear();
  }
  vc.clear();
  lc.clear();
}
void solve() {
  nu = 0;
  flag = 0;
  cin >> s;
  for (int i = 0; i != s; i++) {
    cin >> k[i];
    if (!mark[k[i]]) {
      mark[k[i]] = 1;
      isv[k[i]] = 1;
      vc.push_back({st[k[i]], k[i]});
      lc.push_back({st[k[i]], k[i]});
    }
  }
  sort(vc.begin(), vc.end());
  for (int i = 0; i != vc.size(); i++) {
    u = vc[i].second;
    if (mark[par[u][0]] == 1) {
      flag = 1;
      break;
    }
  }
  u = vc[vc.size() - 1].second;
  v = vc[0].second;
  if (par[u][0] == v || par[v][0] == u) flag = 1;
  if (flag) {
    cout << -1 << endl;
    for (auto i : lc) {
      mark[i.second] = 0;
      isv[i.second] = 0;
    }
    vc.clear();
    lc.clear();
    return;
  }
  for (int i = 0; i != vc.size() - 1; i++) {
    u = vc[i].second;
    v = vc[i + 1].second;
    w = lca(u, v);
    if (w == u || w == v) continue;
    if (!isv[w]) {
      isv[w] = 1;
      lc.push_back({st[w], w});
    }
  }
  sort(lc.begin(), lc.end());
  stack<pair<int, int> > St;
  for (int i = 0; i != lc.size(); i++) {
    u = lc[i].second;
    while (!St.empty() && is_ancle(u, St.top().second) != St.top().second) {
      St.pop();
    }
    if (St.empty())
      fpar[u] = -1;
    else
      fpar[u] = St.top().second;
    St.push({lc[i].first, lc[i].second});
  }
  for (auto i : lc) {
    mk[i.second] = 0;
    dp[i.second] = 0;
  }
  for (auto i : lc) child[i.second].clear();
  for (auto i : lc) {
    if (fpar[i.second] != -1) child[fpar[i.second]].push_back(i.second);
  }
  for (auto i : lc) vis[i.second] = 0;
  dfs2(lc[0].second);
  for (auto i : lc) {
    III[i.second] = vis[i.second];
    vis[i.second] = 0;
  }
  dfs3(lc[0].second);
  cout << nu << endl;
  trash();
}
int main() {
  cin >> n;
  for (int i = 0; i != n - 1; i++) {
    cin >> u >> v;
    G[u].push_back(v);
    G[v].push_back(u);
  }
  cin >> q;
  dfs(1, 0);
  for (int i = 0; i != q; i++) solve();
}
