#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5;
int cnt, n, res;
int tin[maxn], tout[maxn], a[maxn + maxn], dp[maxn], f[maxn][17], st[maxn],
    h[maxn], b[maxn];
bool need[maxn];
vector<int> adj[maxn];
void Input() {
  int x, y;
  cin >> n;
  for (int i = (2); i <= (n); ++i) {
    cin >> x >> y;
    adj[x].push_back(y);
    adj[y].push_back(x);
  }
}
void DFS(int u) {
  tin[u] = ++cnt;
  for (int v : adj[u]) {
    if (h[v] != 0) continue;
    h[v] = h[u] + 1;
    f[v][0] = u;
    for (int i = (1); i <= (16); ++i) f[v][i] = f[f[v][i - 1]][i - 1];
    DFS(v);
  }
  tout[u] = cnt;
}
int LCA(int u, int v) {
  if (h[u] < h[v]) swap(u, v);
  for (int i = (16); i >= (0); --i)
    if (h[u] - (1 << i) >= h[v]) u = f[u][i];
  if (u == v) return u;
  for (int i = (16); i >= (0); --i)
    if (f[u][i] != f[v][i]) u = f[u][i], v = f[v][i];
  return f[u][0];
}
bool cmp(int u, int v) { return tin[u] < tin[v]; }
bool IsAnc(int u, int v) { return tin[u] < tin[v] && tout[v] <= tout[u]; }
bool canbuild(int k) {
  sort(a + 1, a + 1 + k, cmp);
  for (int i = (1); i <= (k - 1); ++i) a[k + i] = LCA(a[i], a[i + 1]);
  k = k + k - 1;
  sort(a + 1, a + 1 + k, cmp);
  k = unique(a + 1, a + 1 + k) - a - 1;
  for (int i = (1); i <= (k); ++i) adj[a[i]].clear();
  int top = 1, u;
  st[1] = a[1];
  for (int i = (2); i <= (k); ++i) {
    while (top >= 1 && !IsAnc(st[top], a[i])) --top;
    if (top == 0) {
      st[++top] = a[i];
      continue;
    }
    u = st[top];
    if (need[u] && need[a[i]] && f[a[i]][0] == u) return false;
    adj[u].push_back(a[i]);
    st[++top] = a[i];
  }
  return true;
}
void Calc(int u) {
  int tmp = 0;
  for (int v : adj[u]) {
    Calc(v);
    tmp += dp[v];
  }
  if (need[u]) {
    res += tmp;
    dp[u] = 1;
  } else {
    if (tmp >= 2)
      dp[u] = 0, ++res;
    else
      dp[u] = tmp;
  }
}
void Solve() {
  h[1] = 1;
  DFS(1);
  int q, k;
  cin >> q;
  for (int i = (1); i <= (q); ++i) {
    cin >> k;
    for (int j = (1); j <= (k); ++j) {
      cin >> a[j];
      b[j] = a[j];
      need[a[j]] = true;
    }
    if (!canbuild(k)) {
      cout << -1 << '\n';
      for (int j = (1); j <= (k); ++j) need[b[j]] = false;
      continue;
    }
    res = 0;
    Calc(st[1]);
    cout << res << '\n';
    for (int j = (1); j <= (k); ++j) need[b[j]] = false;
  }
}
int main() {
  iostream::sync_with_stdio(false);
  cin.tie(0);
  Input();
  Solve();
  return 0;
}
