#include <bits/stdc++.h>
using namespace std;
const int N = 100005;
const int M = 200005;
inline int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return f * x;
}
int n, q, m, a[N], ans;
int hd[N], nxt[M], to[M], tot;
inline void add(int x, int y) {
  to[++tot] = y;
  nxt[tot] = hd[x];
  hd[x] = tot;
}
int fa[N], dep[N], siz[N], son[N];
void dfs_son(int x, int f) {
  fa[x] = f;
  siz[x] = 1;
  dep[x] = dep[f] + 1;
  for (int i = hd[x]; i; i = nxt[i]) {
    int y = to[i];
    if (y == f) continue;
    dfs_son(y, x);
    siz[x] += siz[y];
    if (siz[y] > siz[son[x]]) son[x] = y;
  }
}
int dfn_cnt, dfn[N], top[N];
void dfs_chain(int x, int tp) {
  top[x] = tp;
  dfn[x] = ++dfn_cnt;
  if (son[x]) dfs_chain(son[x], tp);
  for (int i = hd[x]; i; i = nxt[i]) {
    int y = to[i];
    if (y == fa[x] || y == son[x]) continue;
    dfs_chain(y, y);
  }
}
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;
}
bool cmp(int a, int b) { return dfn[a] < dfn[b]; }
int tp, st[N], lca;
inline void ins(int x) {
  if (tp == 0) {
    st[tp = 1] = x;
    return;
  }
  lca = LCA(st[tp], x);
  while ((tp > 1) && (dep[lca] < dep[st[tp - 1]])) {
    add(st[tp - 1], st[tp]);
    --tp;
  }
  if (dep[lca] < dep[st[tp]]) add(lca, st[tp--]);
  if ((!tp) || (st[tp] != lca)) st[++tp] = lca;
  st[++tp] = x;
}
void dfs3(int x) {
  int i;
  if (siz[x])
    for (i = hd[x]; i; i = nxt[i]) {
      dfs3(to[i]);
      if (siz[to[i]]) {
        siz[to[i]] = 0;
        ++ans;
      }
    }
  else {
    for (i = hd[x]; i; i = nxt[i]) {
      dfs3(to[i]);
      siz[x] += siz[to[i]];
      siz[to[i]] = 0;
    }
    if (siz[x] > 1) {
      ++ans;
      siz[x] = 0;
    }
  }
  hd[x] = 0;
}
int main() {
  n = read();
  for (int i = 1, x, y; i < n; i++) {
    x = read();
    y = read();
    add(x, y), add(y, x);
  }
  dep[1] = 1;
  top[1] = 1;
  dfs_son(1, 0);
  dfs_chain(1, 1);
  memset(hd, 0, sizeof hd);
  memset(siz, 0, sizeof siz);
  q = read();
  tot = 0;
  while (q--) {
    int flag = 0;
    m = read();
    for (int i = 1; i <= m; i++) siz[a[i] = read()] = 1;
    for (int i = 1; i <= m; i++)
      if (siz[fa[a[i]]]) {
        puts("-1");
        flag = 1;
        break;
      }
    if (flag) {
      while (m) siz[a[m--]] = 0;
      continue;
    }
    ans = 0;
    sort(a + 1, a + 1 + m, cmp);
    if (a[1] != 1) st[tp = 1] = 1;
    for (int i = 1; i <= m; i++) ins(a[i]);
    if (tp)
      while (--tp) add(st[tp], st[tp + 1]);
    dfs3(1);
    siz[1] = tot = 0;
    printf("%d\n", ans);
  }
}
