#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5;
int n, k, m, u, v, h[maxn];
int pos, fa[maxn][20], dep[maxn], dfn[maxn];
int top, st[maxn], dp[maxn];
vector<int> gg[maxn], g2[maxn];
bool used[maxn], mk[maxn];
queue<int> que;
void init() { pos = 0; }
void process_dfs(int u, int f, int d) {
  fa[u][0] = f;
  dep[u] = d;
  dfn[u] = ++pos;
  for (int i = 1; i < 20; i++) {
    fa[u][i] = fa[fa[u][i - 1]][i - 1];
  }
  for (int i = 0; i < gg[u].size(); i++) {
    int v = gg[u][i];
    if (v != f) process_dfs(v, u, d + 1);
  }
}
int get_lca(int u, int v) {
  if (dep[u] < dep[v]) swap(u, v);
  for (int i = 19; i >= 0; i--) {
    if (dep[fa[u][i]] >= dep[v]) {
      u = fa[u][i];
    }
  }
  for (int i = 19; i >= 0; i--) {
    if (fa[u][i] != fa[v][i]) {
      u = fa[u][i];
      v = fa[v][i];
    }
  }
  if (u != v) u = fa[u][0];
  return u;
}
bool cmp(int x, int y) { return dfn[x] < dfn[y]; }
void dp_dfs(int u) {
  int c = 0;
  dp[u] = 0;
  for (int i = 0; i < g2[u].size(); i++) {
    int v = g2[u][i];
    dp_dfs(v);
    if (used[u]) {
      dp[u] += dp[v] + 1;
      if (!used[v] && !mk[v]) dp[u]--;
    } else {
      dp[u] += dp[v];
      c++;
      if (!used[v] && !mk[v]) c--;
    }
  }
  if (!used[u]) {
    if (c > 1) dp[u]++;
    if (c == 1) {
      mk[u] = 1;
      que.push(u);
    }
  }
  g2[u].clear();
}
void add_edge(int u, int v) {
  if (u == v) return;
  g2[u].push_back(v);
}
int solve() {
  sort(h, h + m, cmp);
  for (int i = 0; i < m; i++) used[h[i]] = 1;
  bool ok = 1;
  for (int i = 0; i < m; i++) {
    if (used[fa[h[i]][0]]) {
      ok = 0;
      break;
    }
  }
  if (ok) {
    top = 0;
    st[++top] = 1;
    for (int i = 0; i < m; i++) {
      int f = get_lca(h[i], st[top]);
      while (1) {
        if (dep[f] >= dep[st[top - 1]]) {
          add_edge(f, st[top--]);
          if (st[top] != f) st[++top] = f;
          break;
        }
        add_edge(st[top - 1], st[top]);
        top--;
      }
      if (st[top] != h[i]) st[++top] = h[i];
    }
    while (--top) add_edge(st[top], st[top + 1]);
    dp_dfs(1);
  }
  for (int i = 0; i < m; i++) used[h[i]] = 0;
  while (!que.empty()) {
    int u = que.front();
    que.pop();
    mk[u] = 0;
  }
  return ok ? dp[1] : -1;
}
int main() {
  scanf("%d", &n);
  init();
  for (int i = 1; i < n; i++) {
    scanf("%d %d", &u, &v);
    gg[u].push_back(v);
    gg[v].push_back(u);
  }
  process_dfs(1, 0, 1);
  scanf("%d", &k);
  while (k--) {
    scanf("%d", &m);
    for (int i = 0; i < m; i++) {
      scanf("%d", &h[i]);
    }
    printf("%d\n", solve());
  }
}
