#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 2, M = 2e5 + 2;
int a[N], to[M], nxt[M], hd[N], dfn[N], top[N], son[N], siz[N], fa[N], dep[N],
    st[N];
int n, m, q, i, x, y, c, bs, tp, lca, ans, dfn_cnt;
inline void read(int &x) {
  c = getchar();
  while ((c < 48) || (c > 57)) c = getchar();
  x = c ^ 48;
  c = getchar();
  while ((c >= 48) && (c <= 57)) {
    x = x * 10 + (c ^ 48);
    c = getchar();
  }
}
inline void add(int x, int y) {
  to[++bs] = y;
  nxt[bs] = hd[x];
  hd[x] = bs;
}
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;
  }
}
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]; }
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() {
  read(n);
  for (i = 1; i < n; i++) {
    read(x);
    read(y);
    add(x, y);
    add(y, x);
  }
  bs = 0;
  dep[1] = 1;
  top[1] = 1;
  dfs_son(1, 0);
  dfs_chain(1, 1);
  memset(hd + 1, 0, n << 2);
  memset(siz + 1, 0, n << 2);
  read(q);
  bs = 0;
  while (q--) {
    x = 1;
    read(m);
    for (i = 1; i <= m; i++) {
      read(a[i]);
      siz[a[i]] = 1;
    }
    for (i = 1; i <= m; i++)
      if (siz[fa[a[i]]]) {
        puts("-1");
        x = 0;
        break;
      }
    if (!x) {
      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 (i = 1; i <= m; i++) ins(a[i]);
    if (tp)
      while (--tp) add(st[tp], st[tp + 1]);
    dfs3(1);
    siz[1] = bs = 0;
    printf("%d\n", ans);
  }
}
