#include <bits/stdc++.h>
using namespace std;
template <typename T, typename U>
inline void smin(T &a, U b) {
  if (a > b) a = b;
}
template <typename T, typename U>
inline void smax(T &a, U b) {
  if (a < b) a = b;
}
template <class T>
inline void gn(T &first) {
  char c, sg = 0;
  while (c = getchar(), (c > '9' || c < '0') && c != '-')
    ;
  for ((c == '-' ? sg = 1, c = getchar() : 0), first = 0; c >= '0' && c <= '9';
       c = getchar())
    first = (first << 1) + (first << 3) + c - '0';
  if (sg) first = -first;
}
template <class T>
inline void print(T first) {
  if (first < 0) {
    putchar('-');
    return print(-first);
  }
  if (first < 10) {
    putchar('0' + first);
    return;
  }
  print(first / 10);
  putchar(first % 10 + '0');
}
template <class T>
inline void println(T first) {
  print(first);
  putchar('\n');
}
int p[100111][22], deep[100111];
int ID[100111];
int id;
vector<int> adj[100111];
int n, q;
int k;
int node[100111];
struct LCA {
  void dfs(int u, int fa = 0) {
    p[u][0] = fa;
    ID[u] = ++id;
    deep[u] = deep[fa] + 1;
    for (int i = 1; i < 18; i++) p[u][i] = p[p[u][i - 1]][i - 1];
    for (int v : adj[u]) {
      if (v == fa) continue;
      dfs(v, u);
    }
  }
  int k_th(int u, int k) {
    for (; k;) u = p[u][(__builtin_ctz(k & -k))], k -= k & -k;
    return u;
  }
  int lca(int a, int b) {
    if (deep[a] > deep[b]) swap(a, b);
    b = k_th(b, deep[b] - deep[a]);
    if (a == b) return a;
    for (int i = 17; i >= 0; i--) {
      if (p[a][i] != p[b][i]) a = p[a][i], b = p[b][i];
    }
    return p[a][0];
  }
} lca;
int vst[100111];
int runs;
int flag[100111];
long long dp[100111][2];
struct Tree {
  vector<int> adj[100111];
  int st[100111];
  int top;
  inline void add(int u, int v) {
    if (vst[u] != runs) adj[u].clear();
    vst[u] = runs;
    adj[u].emplace_back(v);
  }
  inline void del(int u) { adj[u].pop_back(); }
  inline void build() {
    sort(node, node + k, [](int u, int v) { return ID[u] < ID[v]; });
    top = 0;
    for (int i = 0; i < k; i++) {
      int u = node[i];
      flag[u] = runs;
      if (top == 0) {
        st[++top] = u;
        continue;
      }
      int pre = -1;
      int v = lca.lca(u, st[top]);
      while (top and deep[st[top]] >= deep[v]) pre = st[top--];
      if (pre == v)
        add(v, u);
      else {
        del(st[top]);
        add(st[top], v);
        add(v, pre);
        add(v, u);
      }
      st[++top] = v;
      st[++top] = u;
    }
  }
  long long dfs(int u) {
    if (flag[u] == runs) {
      dp[u][0] = 0x3f3f3f3f;
      dp[u][1] = 0;
      for (int v : adj[u]) {
        dfs(v);
        dp[u][1] += min(dp[v][0], dp[v][1] + 1);
      }
    } else {
      dp[u][0] = 0;
      dp[u][1] = 0;
      int tmp;
      long long res = 0;
      long long mn = 0x3f3f3f3f3f3f3f3fLL;
      for (int v : adj[u]) {
        dfs(v);
        tmp = min(dp[v][0], dp[v][1] + 1);
        smin(mn, dp[v][1] - tmp);
        dp[u][0] += tmp;
        res += min(dp[v][0], dp[v][1]);
      }
      dp[u][1] = dp[u][0] + mn;
      smin(dp[u][0], res + 1);
    }
    smin(dp[u][1], 0x3f3f3f3f);
    smin(dp[u][0], 0x3f3f3f3f);
    return min(dp[u][0], dp[u][1]);
  }
} tree;
int solve() {
  gn(k);
  for (int i = 0; i < k; i++) gn(node[i]);
  if (k == 1) return 0;
  runs++;
  for (int i = 0; i < k; i++) vst[node[i]] = runs;
  for (int i = 0; i < k; i++) {
    if (vst[p[node[i]][0]] == runs) return -1;
  }
  runs++;
  tree.build();
  return tree.dfs(tree.st[1]);
}
void jiejue() {
  cin >> n;
  for (int i = 0; i < n - 1; i++) {
    int u, v;
    gn(u);
    gn(v);
    adj[u].emplace_back(v);
    adj[v].emplace_back(u);
  }
  lca.dfs(1);
  cin >> q;
  while (q--) {
    println(solve());
  }
}
int main() {
  jiejue();
  return 0;
}
