#include <bits/stdc++.h>
using namespace std;
const int N = 100005;
vector<int> G[N];
int fa[N][17], tin[N], tout[N], dep[N], dfs_tag = 0;
void dfs(int u, int father) {
  fa[u][0] = father;
  for (int i = 1; i < 17; ++i) {
    fa[u][i] = fa[fa[u][i - 1]][i - 1];
  }
  tin[u] = ++dfs_tag;
  for (auto v : G[u]) {
    if (v == father) continue;
    dep[v] = dep[u] + 1;
    dfs(v, u);
  }
  tout[u] = dfs_tag;
}
inline int lca(int u, int v) {
  if (dep[u] < dep[v]) swap(u, v);
  for (int i = 16; i >= 0; --i) {
    if (dep[fa[u][i]] >= dep[v]) {
      u = fa[u][i];
    }
  }
  if (u == v) return u;
  for (int i = 16; i >= 0; --i) {
    if (fa[u][i] ^ fa[v][i]) {
      u = fa[u][i];
      v = fa[v][i];
    }
  }
  return fa[u][0];
}
int a[N], K;
bool imp[N];
inline bool cmp(int x, int y) { return tin[x] < tin[y]; }
inline int getNext(int p) {
  int l = 0, r = K - 1, c = K;
  while (l <= r) {
    int m = (l + r) >> 1;
    if (tin[a[m]] > p) {
      c = m;
      r = m - 1;
    } else {
      l = m + 1;
    }
  }
  return c;
}
vector<int> g[N];
pair<int, int> st[N];
long long dp[N][2];
void DP(int u) {
  dp[u][0] = dp[u][1] = 0;
  long long x = 0, y = 0, mx = 0;
  for (auto v : g[u]) {
    DP(v);
    if (imp[u]) {
      dp[u][1] += min(dp[v][0], dp[v][1] + 1);
    } else {
      x += dp[v][1];
      y += dp[v][0];
      mx = max(mx, (long long)dp[v][0] - dp[v][1]);
    }
  }
  if (imp[u]) {
    dp[u][0] = 0x3f3f3f3f;
  } else {
    dp[u][0] = min(x + 1, y);
    dp[u][1] = y - mx;
  }
  if (dp[u][0] > 0x3f3f3f3f) dp[u][0] = 0x3f3f3f3f;
  if (dp[u][1] > 0x3f3f3f3f) dp[u][1] = 0x3f3f3f3f;
  if (dp[u][1] > dp[u][0]) dp[u][1] = dp[u][0];
}
int cal(vector<int> &a) {
  int sz = a.size();
  for (int i = 1; i < sz; ++i) {
    a.push_back(lca(a[i - 1], a[i]));
  }
  sort(a.begin(), a.end());
  a.erase(unique(a.begin(), a.end()), a.end());
  sort(a.begin(), a.end(), cmp);
  int top = 0;
  for (auto x : a) {
    int t = tin[x];
    while (top && st[top - 1].second < t) --top;
    if (top) g[st[top - 1].first].push_back(x);
    st[top++] = make_pair(x, tout[x]);
  }
  DP(a[0]);
  for (auto x : a) g[x].clear();
  return dp[a[0]][1];
}
int divide(int l, int r) {
  if (l >= r) return 0;
  int p = l, ret = 0;
  vector<int> vx;
  if (tout[a[l]] >= tin[a[r]]) {
    vx.push_back(a[p++]);
  }
  while (p <= r) {
    vx.push_back(a[p]);
    int np = getNext(tout[a[p]]);
    ret += divide(p, np - 1);
    p = np;
  }
  return ret + cal(vx);
}
int solve() {
  for (int i = 0; i < K; ++i) {
    int u = a[i], f = fa[u][0];
    if (f != u && imp[f]) return -1;
  }
  sort(a, a + K, cmp);
  return divide(0, K - 1);
}
int main() {
  int n;
  scanf("%d", &n);
  for (int u, v, i = 1; i < n; ++i) {
    scanf("%d%d", &u, &v);
    G[u].push_back(v);
    G[v].push_back(u);
  }
  dfs(1, 1);
  int q;
  scanf("%d", &q);
  while (q--) {
    scanf("%d", &K);
    for (int i = 0; i < K; ++i) {
      scanf("%d", a + i);
      imp[a[i]] = true;
    }
    printf("%d\n", solve());
    for (int i = 0; i < K; ++i) {
      imp[a[i]] = false;
    }
  }
  return 0;
}
