#include <bits/stdc++.h>
using namespace std;
const int lg = 17;
const int o = 1 << 18;
const int maxn = 100005;
int n;
vector<int> e[maxn];
int dep[maxn];
int anc[maxn][lg];
int ct;
int disc[maxn];
int fin[maxn];
int t[o * 2];
int q;
int tmp[maxn];
bool b[maxn];
int dp[maxn][2];
stack<int> changes;
int get_lca(int x, int y) {
  if (x == 0 || y == 0) return max(x, y);
  if (dep[x] < dep[y]) swap(x, y);
  int diff = dep[x] - dep[y];
  for (int i = 0; i < lg; i++)
    if (diff & (1 << i)) x = anc[x][i];
  if (x == y) return x;
  for (int i = lg - 1; i >= 0; i--)
    if (anc[x][i] != anc[y][i]) {
      x = anc[x][i];
      y = anc[y][i];
    }
  return anc[x][0];
}
void update(int x, int y) {
  x += o;
  t[x] = y;
  for (x /= 2; x > 0; x /= 2) t[x] = get_lca(t[x * 2], t[x * 2 + 1]);
}
int query(int x, int lo, int hi, int qlo, int qhi) {
  if (lo >= qhi || hi <= qlo) return 0;
  if (lo >= qlo && hi <= qhi) return t[x];
  int mid = (lo + hi) / 2;
  int l = query(x * 2, lo, mid, qlo, qhi);
  int r = query(x * 2 + 1, mid, hi, qlo, qhi);
  return get_lca(l, r);
}
void dfs(int x, int p) {
  disc[x] = ct++;
  for (int i = 0; i < e[x].size(); i++) {
    int y = e[x][i];
    if (y != p) {
      anc[y][0] = x;
      dep[y] = dep[x] + 1;
      dfs(y, x);
    }
  }
  fin[x] = ct++;
}
int solve(int x, int c) {
  if (dp[x][c] != -1) return dp[x][c];
  changes.push(x);
  int sum0 = 0;
  int sum1 = 0;
  vector<int> v0, v1;
  for (int i = 0; i < e[x].size(); i++) {
    int y = e[x][i];
    if (y == anc[x][0]) {
      v0.push_back(0);
      v1.push_back(0);
    } else {
      int trans = query(1, 0, o, disc[y], fin[y] + 1);
      v0.push_back(solve(trans, 0));
      v1.push_back(solve(trans, 1));
    }
    sum0 += v0.back();
    sum1 += v1.back();
  }
  if (b[x] && c == 1) return dp[x][c] = sum0;
  if (b[x] && c == 0) return dp[x][c] = sum0 + 1;
  if (c == 0) return dp[x][c] = min(sum0, sum1 + 1);
  int maxdiff = 0;
  for (int i = 0; i < e[x].size(); i++) maxdiff = max(maxdiff, v0[i] - v1[i]);
  return dp[x][c] = min(sum0 - maxdiff, sum1 + 1);
}
void redo(int k) {
  for (int j = 0; j < k; j++) {
    update(disc[tmp[j]], 0);
    b[tmp[j]] = 0;
  }
}
int main(void) {
  scanf("%d", &n);
  for (int i = 0; i < n - 1; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    e[x].push_back(y);
    e[y].push_back(x);
  }
  dfs(1, 0);
  for (int j = 1; j < lg; j++)
    for (int i = 1; i <= n; i++) anc[i][j] = anc[anc[i][j - 1]][j - 1];
  scanf("%d", &q);
  memset(dp, -1, sizeof dp);
  for (int i = 0; i < q; i++) {
    int k;
    scanf("%d", &k);
    for (int j = 0; j < k; j++) {
      scanf("%d", &tmp[j]);
      update(disc[tmp[j]], tmp[j]);
      b[tmp[j]] = 1;
    }
    bool can = 1;
    for (int j = 0; j < k; j++)
      if (b[anc[tmp[j]][0]]) can = 0;
    if (!can) {
      printf("-1\n");
      redo(k);
      continue;
    }
    printf("%d\n", solve(t[1], 1));
    while (!changes.empty()) {
      int curr = changes.top();
      dp[curr][0] = dp[curr][1] = -1;
      changes.pop();
    }
    redo(k);
  }
  return 0;
}
