#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 200005;
int n, Q;
vector<int> g[MAX_N], G[MAX_N];
int DFN[MAX_N], idx, dep[MAX_N], fa[MAX_N][17];
int A[MAX_N];
bool mark[MAX_N];
void dfs(int v, int last) {
  fa[v][0] = last;
  DFN[v] = ++idx;
  dep[v] = dep[last] + 1;
  for (int i = 0; i < g[v].size(); i++) {
    int to = g[v][i];
    if (to == last) continue;
    dfs(to, v);
  }
}
int dfs(int v) {
  int ret = 0;
  for (int i = 0; i < G[v].size(); i++) ret += dfs(G[v][i]);
  if (mark[v]) {
    for (int i = 0; i < G[v].size(); i++)
      if (mark[G[v][i]]) ret++;
  } else {
    int cnt = 0;
    for (int i = 0; i < G[v].size(); i++)
      if (mark[G[v][i]]) cnt++;
    if (cnt == 1)
      mark[v] = true;
    else if (cnt > 1)
      ret++;
  }
  return ret;
}
int lca(int x, int y) {
  if (dep[x] < dep[y]) swap(x, y);
  for (int i = 16; i >= 0; i--) {
    if (dep[fa[x][i]] >= dep[y]) x = fa[x][i];
  }
  if (x == y) return x;
  for (int i = 16; i >= 0; i--) {
    if (fa[x][i] != fa[y][i]) {
      x = fa[x][i];
      y = fa[y][i];
    }
  }
  return fa[x][0];
}
bool comp(int x, int y) { return DFN[x] < DFN[y]; }
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 1; i < n; i++) {
    int x, y;
    cin >> x >> y;
    g[x].push_back(y);
    g[y].push_back(x);
  }
  dfs(1, 0);
  for (int j = 1; j <= 16; j++) {
    for (int i = 1; i <= n; i++) {
      fa[i][j] = fa[fa[i][j - 1]][j - 1];
    }
  }
  cin >> Q;
  while (Q--) {
    int k;
    cin >> k;
    for (int i = 1; i <= k; i++) cin >> A[i];
    for (int i = 1; i <= k; i++) mark[A[i]] = true;
    bool ok = true;
    for (int i = 1; i <= k; i++) {
      if (mark[fa[A[i]][0]]) {
        ok = false;
        break;
      }
    }
    if (ok) {
      sort(A + 1, A + k + 1, comp);
      int top = k;
      for (int i = 1; i < k; i++) {
        int p = lca(A[i], A[i + 1]);
        if (p != A[i] && p != A[i + 1]) A[++top] = p;
      }
      sort(A + 1, A + top + 1);
      top = unique(A + 1, A + top + 1) - A - 1;
      sort(A + 1, A + top + 1, comp);
      for (int i = 2; i <= top; i++) {
        int p = lca(A[i - 1], A[i]);
        G[p].push_back(A[i]);
      }
      cout << dfs(A[1]) << '\n';
      for (int i = 1; i <= top; i++) mark[A[i]] = false;
      for (int i = 1; i <= top; i++) G[A[i]].clear();
    } else {
      cout << -1 << '\n';
      for (int i = 1; i <= k; i++) mark[A[i]] = false;
    }
  }
  return 0;
}
