#include <bits/stdc++.h>
#pragma GCC optimize(2)
#pragma GCC optimize(3)
using namespace std;
inline int getint() {
  char c;
  int f = 0;
  while (c = getchar(), c > '9' || c < '0')
    ;
  while (f = (f << 1) + (f << 3) + c - '0', c = getchar(), c >= '0' && c <= '9')
    ;
  return f;
}
const int N = 2e5 + 5;
int n, m, q;
struct Edge {
  int to, next;
} edge[N << 1];
struct Node {
  int id;
} a[N];
vector<int> g[N];
int sum_edge, head[N];
int node[N];
bool tag[N];
int st[N], top;
int t[N], dp[N];
int f[N][20], deep[N], dfn[N], tim, log_n;
inline bool cmp(Node a, Node b) { return dfn[a.id] < dfn[b.id]; }
inline void add_edge(int from, int to) {
  ++sum_edge;
  edge[sum_edge].to = to;
  edge[sum_edge].next = head[from];
  head[from] = sum_edge;
}
inline void pre_dfs(int u, int fa) {
  dfn[u] = ++tim;
  int sx = g[u].size();
  for (register int i = 0; i < sx; ++i) {
    int v = g[u][i];
    if (v == fa) continue;
    deep[v] = deep[u] + 1;
    f[v][0] = u;
    pre_dfs(v, u);
  }
}
inline void pre() {
  for (register int i = 1; i <= log_n; ++i)
    for (register int j = 1; j <= n; ++j) f[j][i] = f[f[j][i - 1]][i - 1];
}
inline int lca(int a, int b) {
  if (deep[a] < deep[b]) swap(a, b);
  int c = deep[a] - deep[b];
  for (register int i = 0; i <= log_n; ++i)
    if (c & (1 << i)) a = f[a][i];
  if (a == b) return a;
  for (register int i = log_n; i >= 0; --i)
    if (f[a][i] != f[b][i]) a = f[a][i], b = f[b][i];
  return f[a][0];
}
inline void insert(int u) {
  if (top == 0) {
    st[++top] = u;
    return;
  }
  if (top == 1) {
    int lca_ = lca(st[top], u);
    if (lca_ != u && lca_ != st[top]) {
      add_edge(st[top], lca_);
      add_edge(lca_, st[top]);
      node[++node[0]] = lca_;
      st[top] = lca_;
    }
    st[++top] = u;
    return;
  }
  int lca_ = lca(st[top], u);
  if (lca_ == st[top]) {
    st[++top] = u;
    return;
  }
  while (top > 1 && dfn[lca_] <= dfn[st[top - 1]]) {
    add_edge(st[top], st[top - 1]);
    add_edge(st[top - 1], st[top]);
    --top;
  }
  if (lca_ != st[top]) {
    add_edge(lca_, st[top]);
    add_edge(st[top], lca_);
    st[top] = lca_;
    node[++node[0]] = lca_;
  }
  st[++top] = u;
}
inline void dfs(int u, int fa) {
  t[u] = 0, dp[u] = 0;
  int sum_f = 0, sum_g = 0;
  for (register int i = head[u]; i; i = edge[i].next) {
    int v = edge[i].to;
    if (v == fa) continue;
    dfs(v, u);
    sum_g += t[v];
    sum_f += dp[v];
  }
  if (tag[u]) {
    t[u] = 1;
    dp[u] = sum_g + sum_f;
  } else if (!tag[u] && sum_g <= 1) {
    t[u] = sum_g;
    dp[u] = sum_f;
  } else {
    t[u] = 0;
    dp[u] = sum_f + 1;
  }
}
int main() {
  n = getint();
  log_n = log2(n);
  int x, y;
  for (register int i = 1; i < n; ++i) {
    x = getint(), y = getint();
    g[x].push_back(y);
    g[y].push_back(x);
  }
  pre_dfs(1, 0);
  pre();
  q = getint();
  int po = 0;
  while (q--) {
    m = getint();
    for (register int i = 1; i <= m; ++i) a[i].id = getint();
    sort(a + 1, a + 1 + m, cmp);
    for (register int i = 1; i <= m; ++i) tag[a[i].id] = 1;
    bool ok = 1;
    for (register int i = 1; i <= m; ++i)
      if (tag[f[a[i].id][0]]) {
        ok = 0;
        break;
      }
    if (!ok) {
      puts("-1");
      for (register int i = 1; i <= m; ++i) tag[a[i].id] = 0;
      continue;
    }
    for (register int i = 1; i <= m; ++i)
      insert(a[i].id), node[++node[0]] = a[i].id;
    while (top > 1) {
      add_edge(st[top], st[top - 1]);
      add_edge(st[top - 1], st[top]);
      --top;
    }
    dfs(a[1].id, 0);
    printf("%d\n", dp[a[1].id]);
    for (register int i = 1; i <= m; ++i) tag[a[i].id] = 0;
    for (register int i = 1; i <= node[0]; ++i)
      head[node[i]] = 0, dp[node[i]] = 0, t[node[i]] = 0;
    node[0] = 0;
    top = 0;
    sum_edge = 0;
  }
  return 0;
}
