#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 10;
struct E {
  int to;
  int next;
} ed[maxn * 2];
int head[maxn];
int tot;
void J(int a, int b) {
  ed[++tot].to = b;
  ed[tot].next = head[a];
  head[a] = tot;
}
int dfn[maxn];
int cnt;
int deep[maxn];
int t[maxn][21];
void Dfs(int x, int fa) {
  t[x][0] = fa;
  dfn[x] = ++cnt;
  deep[x] = deep[fa] + 1;
  for (int i = 1; i <= 20; i++) t[x][i] = t[t[x][i - 1]][i - 1];
  for (int i = head[x]; i; i = ed[i].next) {
    if (ed[i].to == fa) continue;
    Dfs(ed[i].to, x);
  }
}
int lca(int x, int y) {
  if (deep[x] < deep[y]) swap(x, y);
  int k = deep[x] - deep[y];
  int id = 0;
  while (k) {
    if (k & 1) x = t[x][id];
    id++;
    k >>= 1;
  }
  if (x == y) return x;
  for (int i = 20; i >= 0; i--)
    if (t[x][i] != t[y][i]) {
      x = t[x][i];
      y = t[y][i];
    }
  return t[x][0];
}
int vis[maxn];
int jl[maxn];
bool cm(int a, int b) { return dfn[a] < dfn[b]; }
int sta[maxn];
int top;
int root;
int Insert(int x) {
  if (!top) {
    sta[++top] = x;
    if (deep[x] < deep[root]) root = x;
    vis[x] = 0;
    head[x] = 0;
    return 1;
  }
  int lc = lca(x, sta[top]);
  if (lc == sta[top]) {
    head[x] = 0;
    sta[++top] = x;
    vis[x] = 0;
    return 1;
  }
  while (top >= 2 && deep[sta[top - 1]] >= deep[lc]) {
    J(sta[top - 1], sta[top]);
    top--;
  }
  if (sta[top] != lc) {
    if (deep[lc] < deep[root]) root = lc;
    head[lc] = 0;
    J(lc, sta[top]);
    sta[top] = lc;
    vis[lc] = 1;
  }
  sta[++top] = x;
  head[x] = 0;
  vis[x] = 0;
  return 1;
}
int bj;
long long dp[maxn][2];
void Dfs_(int x) {
  if (!vis[x]) {
    dp[x][1] = 1e7;
    dp[x][0] = 0;
    for (int i = head[x]; i; i = ed[i].next) {
      Dfs_(ed[i].to);
      if (deep[ed[i].to] - deep[x] == 1)
        dp[x][0] += dp[ed[i].to][1];
      else
        dp[x][0] += min(dp[ed[i].to][1], dp[ed[i].to][0] + 1);
      long long inf = 1e7;
      dp[x][0] = min(dp[x][0], inf);
    }
  } else {
    dp[x][0] = 0;
    dp[x][1] = 0;
    long long ans1 = 0;
    long long ans2 = 1;
    long long ans3 = 0;
    for (int i = head[x]; i; i = ed[i].next) {
      Dfs_(ed[i].to);
      ans1 += dp[ed[i].to][1];
      ans2 += min(dp[ed[i].to][1], dp[ed[i].to][0]);
      ans3 = max(ans3, dp[ed[i].to][1] - dp[ed[i].to][0]);
    }
    if (ans3 > 0)
      dp[x][0] = ans1 - ans3;
    else
      dp[x][0] = ans1;
    dp[x][1] = min(ans2, ans1);
    long long inf = 1e7;
    dp[x][1] = min(dp[x][1], inf);
    dp[x][0] = min(dp[x][0], inf);
  }
}
int main() {
  int n;
  scanf("%d", &n);
  int js1, js2;
  for (int i = 1; i <= n - 1; i++) {
    scanf("%d%d", &js1, &js2);
    J(js1, js2);
    J(js2, js1);
  }
  int t;
  scanf("%d", &t);
  Dfs(1, 0);
  int js;
  memset(head, 0, sizeof(head));
  for (int i = 1; i <= t; i++) {
    scanf("%d", &js);
    top = 0;
    deep[0] = 1e9;
    root = 0;
    tot = 0;
    bj = 0;
    for (int j = 1; j <= js; j++) scanf("%d", &jl[j]);
    sort(jl + 1, jl + 1 + js, cm);
    for (int j = 1; j <= js; j++)
      if (!Insert(jl[j])) {
        bj = 1;
        break;
      }
    while (top >= 2) {
      J(sta[top - 1], sta[top]);
      top--;
    }
    Dfs_(root);
    if (dp[root][0] >= 1e7 - 1 && dp[root][1] >= 1e7 - 1)
      printf("-1\n");
    else
      printf("%lld\n", min(dp[root][0], dp[root][1]));
  }
  return 0;
}
