#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline T read(T &f) {
  f = 0;
  int x = 1;
  char c = getchar();
  while (!isdigit(c)) x = (c == '-' ? -1 : 1), c = getchar();
  while (isdigit(c)) (f *= 10) += c & 15, c = getchar();
  return f = x * f;
}
const int N = 250000 + 5;
const long long INF = 1ll << 60;
int n, m, u, v, w, k, pre[N], low[N], A[N];
struct Edge {
  int to, next, w;
} E[N << 1];
void addedge(int u, int v, int w) {
  static int tot = 0;
  E[++tot] = (Edge){v, pre[u], w}, pre[u] = tot;
  E[++tot] = (Edge){u, pre[v], w}, pre[v] = tot;
}
const int lgN = 22;
int fa[N][lgN], dfn[N], dep[N];
long long mn[N];
void dfs(int u, int f) {
  static int cnt = 0;
  dfn[u] = ++cnt;
  for (int i = pre[u]; i; i = E[i].next) {
    int v = E[i].to;
    if (v == f) continue;
    fa[v][0] = u, dep[v] = dep[u] + 1;
    dfs(v, u);
  }
  low[u] = cnt;
}
void init() {
  for (int i = (1), ___ = (21); i <= ___; ++i)
    for (int j = (1), ___ = (n); j <= ___; ++j) {
      fa[j][i] = fa[fa[j][i - 1]][i - 1];
    }
}
int lca(int u, int v) {
  if (dep[u] < dep[v]) swap(u, v);
  int ret = dep[u] - dep[v];
  for (int i = 0; ret; ret >>= 1, ++i) {
    if (ret & 1) u = fa[u][i];
  }
  if (u == v) return u;
  for (int i = (21), ___ = (0); i >= ___; --i)
    if (fa[u][i] != fa[v][i]) {
      u = fa[u][i], v = fa[v][i];
    }
  return fa[v][0];
}
inline int comp(const int &x, const int &y) { return dfn[x] < dfn[y]; }
vector<int> G[N];
void addE(int u, int v) {
  if (u == v) return;
  G[u].push_back(v);
}
int vis[N], sz[N];
long long solve(int u) {
  int cnt = 0, res = 0;
  for (int i = (0), ___ = (G[u].size() - 1); i <= ___; ++i) {
    res += solve(G[u][i]);
    cnt += sz[G[u][i]];
  }
  if (vis[u])
    res += cnt, sz[u] = 1;
  else
    res += (cnt > 1), sz[u] = (cnt == 1);
  return res;
}
vector<int> V, S;
int judge(int x, int y) { return dfn[x] >= dfn[y] && dfn[x] <= low[y]; }
void build() {
  for (int i = (1), ___ = (k); i <= ___; ++i) V.push_back(A[i]);
  sort(V.begin(), V.end(), comp);
  for (int i = (1), ___ = (k - 1); i <= ___; ++i)
    V.push_back(lca(V[i - 1], V[i]));
  sort(V.begin(), V.end(), comp);
  auto newN = unique(V.begin(), V.end());
  V.erase(newN, V.end());
  while (!S.empty()) S.pop_back();
  for (int x : V) {
    G[x].clear();
    while (!S.empty() && !judge(x, S.back())) S.pop_back();
    if (!S.empty()) addE(S.back(), x);
    S.push_back(x);
  }
}
int main() {
  read(n), dep[1] = 1;
  for (int i = (1), ___ = (n - 1); i <= ___; ++i) {
    read(u), read(v), addedge(u, v, w);
  }
  dfs(1, 0), init(), read(m);
  while (m--) {
    read(k), V.clear();
    for (int i = (1), ___ = (k); i <= ___; ++i) vis[read(A[i])] = 1;
    build();
    int flag = 1;
    for (int i = (1), ___ = (k); i <= ___; ++i)
      if (vis[fa[A[i]][0]]) {
        flag = 0;
        break;
      }
    if (!flag) {
      for (int i = (1), ___ = (k); i <= ___; ++i) vis[A[i]] = 0;
      puts("-1");
      continue;
    }
    printf("%lld\n", solve(V[0]));
    for (int i = (1), ___ = (k); i <= ___; ++i) vis[A[i]] = 0;
  }
  return 0;
}
