#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int f = 1, x = 0;
  char s = getchar();
  while (s < '0' || s > '9') {
    if (s == '-') f = -1;
    s = getchar();
  }
  while (s >= '0' && s <= '9') {
    x = x * 10 + s - 48;
    s = getchar();
  }
  return f * x;
}
struct edge {
  int to, next;
} e[100005 << 1];
int head[100005], tot, n, m, a[100005], size[100005], top[100005], id[100005];
int d[100005], g[100005], sta[100005], tp, cnt, son[100005], f[100005];
int ans;
inline void add(int a, int b) {
  e[++tot].next = head[a];
  e[tot].to = b;
  head[a] = tot;
}
void dfs1(int u) {
  d[u] = d[f[u]] + 1;
  size[u] = 1;
  for (int i = head[u]; i; i = e[i].next) {
    int v = e[i].to;
    if (v == f[u]) continue;
    f[v] = u;
    dfs1(v);
    size[u] += size[v];
    if (size[v] > size[son[u]]) son[u] = v;
  }
}
void dfs2(int u, int t) {
  id[u] = ++cnt;
  top[u] = t;
  if (son[u]) dfs2(son[u], t);
  for (int i = head[u]; i; i = e[i].next) {
    int v = e[i].to;
    if (v == son[u] || v == f[u]) continue;
    dfs2(v, v);
  }
}
int lca(int x, int y) {
  while (top[x] != top[y]) {
    if (d[top[x]] < d[top[y]]) swap(x, y);
    x = f[top[x]];
  }
  return d[x] < d[y] ? x : y;
}
void ins(int x) {
  if (!tp) {
    sta[++tp] = x;
    return;
  }
  int LCA = lca(sta[tp], x);
  while (tp > 1 && d[LCA] < d[sta[tp - 1]]) {
    add(sta[tp - 1], sta[tp]);
    tp--;
  }
  if (d[LCA] < d[sta[tp]]) add(LCA, sta[tp--]);
  if (!tp || sta[tp] != LCA) sta[++tp] = LCA;
  sta[++tp] = x;
}
void dfs3(int u) {
  if (g[u])
    for (int i = head[u]; i; i = e[i].next) {
      int v = e[i].to;
      dfs3(v);
      if (g[v]) {
        ans++;
        g[v] = 0;
      }
    }
  else {
    for (int i = head[u]; i; i = e[i].next) {
      int v = e[i].to;
      dfs3(v);
      g[u] += g[v];
      g[v] = 0;
    }
    if (g[u] > 1) {
      ans++;
      g[u] = 0;
    }
  }
  head[u] = 0;
}
bool cmp(int x, int y) { return id[x] < id[y]; }
int main() {
  n = read();
  for (int i = 1; i < n; i++) {
    int a = read(), b = read();
    add(a, b);
    add(b, a);
  }
  dfs1(1);
  dfs2(1, 1);
  memset(head, 0, sizeof(head));
  tot = 0;
  m = read();
  while (m--) {
    int k = read();
    int flag = 0;
    for (int i = 1; i <= k; i++) a[i] = read(), g[a[i]] = 1;
    for (int i = 1; i <= k; i++)
      if (g[f[a[i]]]) {
        puts("-1");
        for (int j = 1; j <= k; j++) g[a[j]] = 0;
        flag = 1;
        break;
      }
    if (flag) continue;
    tp = ans = 0;
    sort(a + 1, a + k + 1, cmp);
    if (a[1] != 1) sta[++tp] = 1;
    for (int i = 1; i <= k; i++) ins(a[i]);
    if (tp) {
      for (int i = 1; i < tp; i++) add(sta[i], sta[i + 1]);
      tp = 0;
    }
    dfs3(1);
    printf("%d\n", ans);
    g[1] = tot = 0;
  }
  return 0;
}
