#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 5;
int n, k, m;
vector<int> q[MAXN];
int tot;
int dfn[MAXN], dep[MAXN];
int f[MAXN][21];
void dfs_init(int x, int pr) {
  tot++;
  dfn[x] = tot, dep[x] = dep[pr] + 1, f[x][0] = pr;
  for (int i = 1; i <= 20; i++) f[x][i] = f[f[x][i - 1]][i - 1];
  for (int i = 0; i < q[x].size(); i++) {
    int nx = q[x][i];
    if (nx == pr) continue;
    dfs_init(nx, x);
  }
}
int lca(int l, int r) {
  if (dep[l] < dep[r]) swap(l, r);
  for (int i = 20; i >= 0; i--) {
    if (dep[f[l][i]] < dep[r]) continue;
    l = f[l][i];
  }
  if (l == r) return l;
  for (int i = 20; i >= 0; i--) {
    if (f[l][i] == f[r][i]) continue;
    l = f[l][i], r = f[r][i];
  }
  return f[l][0];
}
bool vis[MAXN];
int tr[MAXN];
int a[MAXN];
stack<int> st;
bool cmp(const int &aa, const int &bb) { return dfn[aa] < dfn[bb]; }
int cal(int x) {
  if (vis[x]) {
    int an = tr[x] - 1;
    tr[x] = 1;
    return an;
  } else {
    if (tr[x] > 1) {
      tr[x] = 0;
      return 1;
    } else {
      return 0;
    }
  }
}
int tree() {
  sort(a + 1, a + 1 + k, cmp);
  bool ok = 0;
  for (int i = 1; i <= k; i++) vis[a[i]] = tr[a[i]] = 1;
  for (int i = 1; i <= k; i++)
    if (vis[f[a[i]][0]]) ok = 1;
  if (ok) {
    for (int i = 1; i <= k; i++) vis[a[i]] = tr[a[i]] = 0;
    return -1;
  }
  st.push(0);
  int an = 0;
  for (int i = 1; i <= k; i++) {
    int fa = lca(st.top(), a[i]);
    if (fa == st.top()) {
      st.push(a[i]);
      continue;
    }
    while (dep[st.top()] > dep[fa]) {
      int son = st.top();
      st.pop();
      an += cal(son);
      if (dep[st.top()] > dep[fa]) {
        tr[st.top()] += tr[son];
      } else {
        tr[fa] += tr[son];
        if (fa != st.top()) {
          st.push(fa);
        }
      }
      vis[son] = tr[son] = 0;
    }
    st.push(a[i]);
  }
  while (!st.empty()) {
    int son = st.top();
    st.pop();
    if (!son) break;
    an += cal(son);
    tr[st.top()] += tr[son];
    vis[son] = tr[son] = 0;
  }
  vis[0] = tr[0] = 0;
  return an;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i < n; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    q[x].push_back(y);
    q[y].push_back(x);
  }
  dfs_init(1, 0);
  scanf("%d", &m);
  for (int i = 1; i <= m; i++) {
    scanf("%d", &k);
    for (int j = 1; j <= k; j++) scanf("%d", &a[j]);
    printf("%d\n", tree());
  }
  return 0;
}
