#include <bits/stdc++.h>
char buf[1 << 20], *f1 = buf, *f2 = buf;
inline int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = (x << 3) + (x << 1) + (ch ^ 48);
    ch = getchar();
  }
  return x * f;
}
template <class T>
inline T max(T a, T b) {
  return a > b ? a : b;
}
template <class T>
inline T min(T a, T b) {
  return a < b ? a : b;
}
template <class T>
inline void swap(T &a, T &b) {
  a ^= b ^= a ^= b;
}
template <class T>
inline T abs(T a) {
  return a < 0 ? -a : a;
}
int n, m, k, tp, cnt;
const int N = 1e5 + 5;
int a[N], fa[N], dep[N], size[N], hs[N], top[N], dfn[N], id[N], st[N], b[N];
bool vis[N];
struct Edge {
  int to;
  Edge *nxt;
  Edge(int to = 0, Edge *nxt = NULL) : to(to), nxt(nxt) {}
} * head[N], pool[N << 1], *tail = pool;
inline void add(int u, int v) { head[u] = new (tail++) Edge(v, head[u]); }
void get_tree(int x) {
  dep[x] = dep[fa[x]] + 1;
  size[x] = 1;
  for (Edge *i = head[x]; i; i = i->nxt) {
    int to = i->to;
    if (to == fa[x]) continue;
    fa[to] = x;
    get_tree(to);
    size[x] += size[to];
    if (size[to] > size[hs[x]]) hs[x] = to;
  }
}
void dfs(int x, int topfa) {
  top[x] = topfa;
  dfn[x] = ++cnt;
  id[cnt] = x;
  if (hs[x]) dfs(hs[x], topfa);
  for (Edge *i = head[x]; i; i = i->nxt) {
    int to = i->to;
    if (to == fa[x] || to == hs[x]) continue;
    dfs(to, to);
  }
}
inline int LCA(int x, int y) {
  while (top[x] != top[y]) {
    if (dep[top[x]] < dep[top[y]]) swap(x, y);
    x = fa[top[x]];
  }
  return dep[x] < dep[y] ? x : y;
}
inline bool cmp(const int &a, const int &b) { return dfn[a] < dfn[b]; }
inline void clear(int x) { head[x] = NULL; }
inline void Build() {
  std::sort(a, a + k, cmp);
  st[tp = 1] = 1;
  clear(1);
  for (int *p = a, lca; *p; p++) {
    if (*p == 1) continue;
    lca = LCA(*p, st[tp]);
    if (lca != st[tp]) {
      while (dfn[lca] < dfn[st[tp - 1]]) add(st[tp - 1], st[tp]), tp--;
      if (dfn[lca] > dfn[st[tp - 1]])
        clear(lca), add(lca, st[tp]), st[tp] = lca;
      else
        add(lca, st[tp--]);
    }
    clear(*p);
    st[++tp] = *p;
  }
  for (int i = 1; i < tp; i++) add(st[i], st[i + 1]);
}
int get_ans(int x) {
  int ans = 0, sum = 0;
  for (Edge *i = head[x]; i; i = i->nxt) {
    int to = i->to;
    ans += get_ans(to);
    sum += b[to];
  }
  if (vis[x])
    b[x] = 1, ans += sum;
  else if (sum > 1)
    b[x] = 0, ans++;
  else
    b[x] = sum;
  return ans;
}
int main() {
  n = read();
  for (int i = 1, u, v; i < n; i++)
    u = read(), v = read(), add(u, v), add(v, u);
  get_tree(1);
  dfs(1, 1);
  m = read();
  while (m-- > 0) {
    tail = pool;
    k = read();
    bool flag = 0;
    for (int i = 0; i < k; i++) a[i] = read(), vis[a[i]] = 1;
    a[k] = 0;
    for (int *p = a; *p; p++)
      if (vis[fa[*p]]) {
        flag = 1;
        break;
      }
    if (!flag) Build();
    printf("%d\n", flag ? -1 : get_ans(1));
    for (int *p = a; *p; p++) vis[*p] = 0;
  }
  return 0;
}
