#include <bits/stdc++.h>
using namespace std;
template <class _Tp>
void ckmax(_Tp &a, _Tp b) {
  if (a < b) a = b;
}
template <class _Tp>
void ckmin(_Tp &a, _Tp b) {
  if (a > b) a = b;
}
template <class _Tp>
_Tp gcd(_Tp a, _Tp b) {
  return (b == 0) ? (a) : (gcd(b, a % b));
}
int read() {
  char ch = getchar();
  bool f = 1;
  int x = 0;
  while ((ch < '0' || ch > '9') && ch != '-') ch = getchar();
  if (ch == '-') f = 0, ch = getchar();
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + (ch & 15);
    ch = getchar();
  }
  return f ? x : -x;
}
const int inf = 1000000000;
const long long Inf = 1000000000000000000ll;
struct Edge {
  int to, nxt;
} e[100050 << 1], e1[100050 << 1];
int head[100050], Top;
int head1[100050], Top1;
void add(int u, int v) {
  e[++Top].to = v;
  e[Top].nxt = head[u];
  head[u] = Top;
}
void adde(int u, int v) {
  e1[++Top1].to = v;
  e1[Top1].nxt = head1[u];
  head1[u] = Top1;
}
int fa[100050], dep[100050], siz[100050], son[100050];
int dfn[100050], topfa[100050], cnt;
void dfs1(int u, int f, int d) {
  fa[u] = f;
  dep[u] = d;
  siz[u] = 1;
  for (int i = head[u]; i; i = e[i].nxt) {
    if (e[i].to == f) continue;
    dfs1(e[i].to, u, d + 1);
    siz[u] += siz[e[i].to];
    if (siz[e[i].to] > siz[son[u]]) son[u] = e[i].to;
  }
}
void dfs2(int u, int topf) {
  dfn[u] = ++cnt;
  topfa[u] = topf;
  if (!son[u]) return;
  dfs2(son[u], topf);
  for (int i = head[u]; i; i = e[i].nxt) {
    if (e[i].to == fa[u] || e[i].to == son[u]) continue;
    dfs2(e[i].to, e[i].to);
  }
}
int lca(int x, int y) {
  while (topfa[x] != topfa[y]) {
    if (dep[topfa[x]] < dep[topfa[y]]) swap(x, y);
    x = fa[topfa[x]];
  }
  return dep[x] < dep[y] ? x : y;
}
bool cmp(int x, int y) { return dfn[x] < dfn[y]; }
int g[100050], vis[100050];
int dfs(int u) {
  int res = 0, nm = 0;
  for (int i = head1[u]; i; i = e1[i].nxt)
    res += dfs(e1[i].to), nm += g[e1[i].to];
  if (vis[u])
    res += nm, g[u] = 1;
  else if (nm > 1)
    ++res, g[u] = 0;
  else
    g[u] = nm ? 1 : 0;
  head1[u] = 0;
  vis[u] = 0;
  return res;
}
int n, q, m, b[100050], top, stk[100050];
int main() {
  n = read();
  for (int i = 1, x, y; i < n; ++i) {
    x = read();
    y = read();
    add(x, y);
    add(y, x);
  }
  dfs1(1, 0, 1);
  dfs2(1, 1);
  q = read();
  while (q--) {
    m = read();
    bool flag = 1;
    Top1 = 0;
    for (int i = 1; i <= m; ++i) b[i] = read(), vis[b[i]] = 1;
    for (int i = 1; i <= m; ++i)
      if (vis[fa[b[i]]]) flag = 0;
    if (!flag) {
      for (int i = 1; i <= m; ++i) vis[b[i]] = 0;
      puts("-1");
      continue;
    }
    sort(b + 1, b + m + 1, cmp);
    top = 1;
    stk[1] = b[1];
    for (int i = 2, f; i <= m; ++i) {
      f = lca(stk[top], b[i]);
      while (dep[f] < dep[stk[top - 1]]) adde(stk[top - 1], stk[top]), top--;
      if (f != stk[top]) {
        adde(f, stk[top]);
        if (stk[top - 1] == f)
          top--;
        else
          stk[top] = f;
      }
      stk[++top] = b[i];
    }
    while (--top) adde(stk[top], stk[top + 1]);
    printf("%d\n", dfs(stk[1]));
  }
  return 0;
}
