#include <bits/stdc++.h>
using namespace std;
const int maxn = 100006;
struct Edge {
  int to, nxt;
} edge[maxn << 1];
int head[maxn], tot;
void addedge(int x, int y) {
  edge[++tot].to = y;
  edge[tot].nxt = head[x];
  head[x] = tot;
}
int d[maxn], dp[maxn][20];
int maxdep = 16;
queue<int> q;
void bfs() {
  d[1] = 1;
  q.push(1);
  while (!q.empty()) {
    int x = q.front();
    q.pop();
    for (int i = head[x]; i; i = edge[i].nxt) {
      int y = edge[i].to;
      if (d[y]) continue;
      d[y] = d[x] + 1;
      q.push(y);
      dp[y][0] = x;
      for (int j = 1; j <= maxdep; j++) dp[y][j] = dp[dp[y][j - 1]][j - 1];
    }
  }
}
int lca(int x, int y) {
  if (d[x] > d[y]) swap(x, y);
  for (int i = maxdep; i >= 0; i--)
    if (d[dp[y][i]] >= d[x]) y = dp[y][i];
  if (y == x) return x;
  for (int i = maxdep; i >= 0; i--)
    if (dp[x][i] != dp[y][i]) x = dp[x][i], y = dp[y][i];
  return dp[x][0];
}
int a[maxn], use[maxn];
int f[maxn], cnt[maxn];
void dfs1(int x, int fa) {
  f[x] = cnt[x] = 0;
  for (int i = head[x]; i; i = edge[i].nxt) {
    int y = edge[i].to;
    if (y == fa) continue;
    dfs1(y, x);
    f[x] += f[y];
    cnt[x] += cnt[y];
  }
  if (use[x])
    f[x] += cnt[x], cnt[x] = 1;
  else if (cnt[x] > 1)
    f[x]++, cnt[x] = 0;
  head[x] = 0;
}
int dfn[maxn], id;
int Fa[maxn];
int sta[maxn], top;
void dfs(int x, int fa) {
  Fa[x] = fa;
  dfn[x] = ++id;
  d[x] = d[fa] + 1;
  for (int i = head[x]; i; i = edge[i].nxt)
    if (edge[i].to != fa) dfs(edge[i].to, x);
}
bool cmp(int x, int y) { return dfn[x] < dfn[y]; }
int build(int n) {
  top = 0;
  tot = 0;
  sort(a + 1, a + n + 1, cmp);
  for (int i = 1; i <= n; i++)
    if (use[Fa[a[i]]]) return -1;
  sta[++top] = a[1];
  for (int i = 2; i <= n; i++) {
    int x = lca(a[i], sta[top]);
    while (top > 1 && d[sta[top - 1]] > d[x])
      addedge(sta[top - 1], sta[top]), addedge(sta[top], sta[top - 1]), top--;
    if (top && d[x] < d[sta[top]])
      addedge(x, sta[top]), addedge(sta[top], x), top--;
    if (!top || sta[top] != x) sta[++top] = x;
    if (sta[top] != a[i]) sta[++top] = a[i];
  }
  while (top > 1)
    addedge(sta[top - 1], sta[top]), addedge(sta[top], sta[top - 1]), top--;
  dfs1(a[1], 0);
  return f[a[1]];
}
int n;
int main() {
  scanf("%d", &n);
  int x, y;
  for (int i = 1; i < n; i++) {
    scanf("%d%d", &x, &y);
    addedge(x, y);
    addedge(y, x);
  }
  bfs();
  dfs(1, 0);
  for (int i = 1; i <= n; i++) head[i] = 0;
  int _;
  scanf("%d", &_);
  while (_--) {
    int m;
    scanf("%d", &m);
    for (int i = 1; i <= m; i++) {
      scanf("%d", &a[i]);
      use[a[i]] = 1;
    }
    printf("%d\n", build(m));
    for (int i = 1; i <= m; i++) use[a[i]] = 0;
  }
  return 0;
}
