#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
int n;
struct node {
  int to, nex;
} e[N], a[N << 1];
int head[N], cnt;
void add1(int x, int y) {
  a[++cnt] = (node){y, head[x]};
  head[x] = cnt;
}
void add(int x, int y) {
  e[++cnt] = (node){y, head[x]};
  head[x] = cnt;
}
int dep[N], fa[N], siz[N], hs[N];
void dfs1(int x) {
  dep[x] = dep[fa[x]] + 1;
  siz[x] = 1;
  hs[x] = -1;
  for (int i = head[x]; i; i = a[i].nex) {
    int k = a[i].to;
    if (k == fa[x]) continue;
    fa[k] = x;
    dfs1(k);
    siz[x] += siz[k];
    if (hs[x] == -1 || siz[k] > siz[hs[x]]) hs[x] = k;
  }
}
int top[N], dfn[N], res, nfd[N];
void dfs2(int x, int t) {
  top[x] = t;
  dfn[++res] = x;
  nfd[x] = res;
  if (hs[x] == -1) return;
  dfs2(hs[x], t);
  for (int i = head[x]; i; i = a[i].nex) {
    int k = a[i].to;
    if (k == fa[x] || k == hs[x]) continue;
    dfs2(k, k);
  }
}
int c[N];
bool comp(int x, int y) { return nfd[x] < nfd[y]; }
int st[N], tot;
int lca(int x, int y) {
  while (top[x] != top[y]) {
    if (dep[top[x]] > dep[top[y]]) swap(x, y);
    y = fa[top[y]];
  }
  return dep[x] > dep[y] ? y : x;
}
void insert(int x) {
  if (!tot) return (void)(st[tot = 1] = x);
  int s = lca(st[tot], x);
  while (tot > 1 && dep[s] < dep[st[tot - 1]]) {
    add(st[tot - 1], st[tot]);
    tot--;
  }
  if (dep[s] < dep[st[tot]]) add(s, st[tot--]);
  if (!tot || st[tot] != s) st[++tot] = s;
  st[++tot] = x;
}
int ans = 0;
void dfs3(int x) {
  if (siz[x]) {
    for (int i = head[x]; i; i = e[i].nex) {
      int k = e[i].to;
      dfs3(k);
      if (siz[k]) siz[k] = 0, ans++;
    }
  } else {
    for (int i = head[x]; i; i = e[i].nex) {
      int k = e[i].to;
      dfs3(k);
      siz[x] += siz[k];
      siz[k] = 0;
    }
    if (siz[x] > 1) ans++, siz[x] = 0;
  }
  head[x] = 0;
}
int main() {
  cin >> n;
  for (int x, y, i = 1; i < n; i++) {
    cin >> x >> y;
    add1(x, y);
    add1(y, x);
  }
  dfs1(1);
  dfs2(1, 1);
  memset(siz, 0, sizeof(siz));
  memset(head, 0, sizeof(head));
  cnt = 0;
  int q, m;
  cin >> q;
  while (q--) {
    cin >> m;
    for (int i = 1; i <= m; i++) cin >> c[i], siz[c[i]] = 1;
    int x = 1;
    for (int i = 1; i <= m; i++) {
      if (siz[fa[c[i]]]) {
        cout << "-1" << endl;
        x = 0;
        break;
      }
    }
    if (!x) {
      while (m) siz[c[m--]] = 0;
      continue;
    }
    sort(c + 1, c + 1 + m, comp);
    if (c[1] != 1) st[tot = 1] = 1;
    for (int i = 1; i <= m; i++) insert(c[i]);
    if (tot)
      while (--tot) add(st[tot], st[tot + 1]);
    dfs3(1);
    cout << ans << endl;
    for (int i = 1; i <= m; i++) head[i] = 0, siz[i] = 0;
    cnt = 0;
    ans = 0;
    tot = 0;
  }
  return 0;
}
