#include <bits/stdc++.h>
using namespace std;
const int N = 100005, LG = 17;
int n, q, ts, St[N], Fn[N], H[N], P[N][LG], M[N], dp[N][2];
vector<int> Ad[N], Adj[N];
void DFS(int v, int p) {
  St[v] = ts++;
  for (int i = 1; i < LG; i++) P[v][i] = P[P[v][i - 1]][i - 1];
  for (int u : Adj[v])
    if (u != p) P[u][0] = v, H[u] = H[v] + 1, DFS(u, v);
  Fn[v] = ts;
}
inline int LCA(int v, int u) {
  if (H[v] < H[u]) return (LCA(u, v));
  for (int i = 0; i < LG; i++)
    if ((H[v] - H[u]) & (1 << i)) v = P[v][i];
  if (v == u) return (v);
  for (int i = LG - 1; ~i; i--)
    if (P[v][i] != P[u][i]) v = P[v][i], u = P[u][i];
  return (P[v][0]);
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i < n; i++) {
    int v, u;
    scanf("%d%d", &v, &u);
    Adj[v].push_back(u);
    Adj[u].push_back(v);
  }
  DFS(1, 0);
  scanf("%d", &q);
  for (; q; q--) {
    int k, f = 0;
    scanf("%d", &k);
    vector<int> vec(k);
    for (int &v : vec) scanf("%d", &v), M[v] = 1;
    sort(vec.begin(), vec.end(), [&](int a, int b) { return (St[a] < St[b]); });
    for (int i = 0; i < k; i++)
      vec.push_back(LCA(vec[i], vec[(i + 1) % k])), f |= M[P[vec[i]][0]];
    if (f) {
      for (int v : vec) M[v] = 0;
      printf("-1\n");
      continue;
    }
    sort(vec.begin(), vec.end(), [&](int a, int b) { return (St[a] < St[b]); });
    vec.resize(unique(vec.begin(), vec.end()) - vec.begin());
    vector<int> P = {vec[0]};
    for (int i = 1; i < (int)vec.size(); i++) {
      while (Fn[vec[i]] > Fn[P.back()]) P.pop_back();
      Ad[P.back()].push_back(vec[i]);
      P.push_back(vec[i]);
    }
    for (int i = (int)vec.size() - 1; ~i; i--) {
      int v = vec[i];
      if (M[v]) {
        dp[v][0] = 0;
        for (int u : Ad[v]) dp[v][0] += dp[u][1];
        dp[v][1] = dp[v][0] + 1;
      } else {
        dp[v][1] = 1;
        int Mn = N, SM = 0;
        for (int u : Ad[v]) {
          dp[v][1] += dp[u][0];
          Mn = min(Mn, dp[u][0] - dp[u][1]);
          SM += dp[u][1];
        }
        dp[v][1] = min(dp[v][1], SM);
        dp[v][0] = SM + Mn;
      }
      dp[v][0] = min(dp[v][0], dp[v][1]);
      Ad[v].clear();
      M[v] = 0;
    }
    printf("%d\n", dp[vec[0]][0]);
  }
  return 0;
}
