#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 10;
int sta[maxn], id[maxn];
vector<int> sp[maxn], g[maxn], us;
int w[maxn];
int pre[maxn][35];
int dep[maxn];
int tim;
void init(int u, int fa) {
  id[u] = tim++;
  for (auto &v : sp[u]) {
    if (v == fa) continue;
    pre[v][0] = u;
    dep[v] = dep[u] + 1;
    w[v] = w[u] + 1;
    init(v, u);
  }
}
void bz(int n) {
  for (int j = 1; j <= 30; ++j) {
    for (int i = 1; i <= n; ++i) {
      pre[i][j] = pre[pre[i][j - 1]][j - 1];
    }
  }
}
int lca(int u, int v) {
  if (dep[u] < dep[v]) swap(u, v);
  int dc = dep[u] - dep[v];
  for (int i = 0; i < 30; ++i) {
    if ((1ll << i) & dc) u = pre[u][i];
  }
  if (u == v) return u;
  for (int i = 29; i >= 0; --i) {
    if (pre[u][i] != pre[v][i]) {
      u = pre[u][i], v = pre[v][i];
    }
  }
  u = pre[u][0];
  return u;
}
bool cmp(int x, int y) { return id[x] < id[y]; }
void build(int k) {
  int top = 0;
  g[1].clear();
  g[sta[1]].clear();
  sta[++top] = 1;
  for (int i = 0; i < k; ++i) {
    if (us[i] == 1) continue;
    int lc = lca(us[i], sta[top]);
    if (lc != sta[top]) {
      while (id[lc] < id[sta[top - 1]]) {
        g[sta[top - 1]].push_back(sta[top]);
        top--;
      }
      if (id[lc] > id[sta[top - 1]]) {
        g[lc].clear();
        g[lc].push_back(sta[top]);
        sta[top] = lc;
      } else {
        g[lc].push_back(sta[top]);
        top--;
      }
    }
    g[us[i]].clear(), sta[++top] = us[i];
  }
  for (int i = 1; i < top; ++i) {
    g[sta[i]].push_back(sta[i + 1]);
  }
}
int num[maxn], vis[maxn];
int ans, flag;
void solve(int u, int fa) {
  if (vis[u]) num[u]++;
  int cur = 0;
  for (auto &v : g[u]) {
    if (v == fa) continue;
    solve(v, u);
    int deep = w[v] - w[u];
    if (vis[u] && vis[v] && deep <= 1) {
      flag = 1;
      return;
    }
    if (num[v]) cur++;
    num[v] = vis[v] = 0;
  }
  if (vis[u]) ans += cur;
  if (!vis[u] && cur > 1)
    ans++, num[u] = 0;
  else if (!vis[u] && cur == 1) {
    num[u] = 1;
  }
  g[u].clear();
}
int main() {
  int n;
  cin >> n;
  for (int i = 1, u, v; i <= n - 1; ++i) {
    cin >> u >> v;
    sp[u].push_back(v);
    sp[v].push_back(u);
  }
  tim = 1;
  init(1, 0);
  bz(n);
  int q, k;
  cin >> q;
  while (q--) {
    cin >> k;
    us.clear();
    ans = flag = 0;
    for (int i = 1, u; i <= k; ++i) {
      cin >> u;
      vis[u] = 1;
      us.push_back(u);
    }
    sort(us.begin(), us.end(), cmp);
    build(k);
    solve(1, 0);
    for (auto &v : us) vis[v] = num[v] = 0;
    if (flag) {
      cout << -1 << endl;
    } else
      cout << ans << endl;
  }
  return 0;
}
