#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 2, M = 2e5 + 2;
int a[N], lj[M], nxt[M], fir[N], dfn[N], top[N], hc[N], siz[N], f[N], dep[N],
    st[N];
int n, m, q, i, x, y, c, bs, tp, ance, ans;
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) {
  lj[++bs] = y;
  nxt[bs] = fir[x];
  fir[x] = bs;
}
void dfs1(int x) {
  siz[x] = 1;
  int i;
  for (i = fir[x]; i; i = nxt[i])
    if (lj[i] != f[x]) {
      dep[lj[i]] = dep[f[lj[i]] = x] + 1;
      dfs1(lj[i]);
      siz[x] += siz[lj[i]];
      if (siz[hc[x]] < siz[lj[i]]) hc[x] = lj[i];
    }
}
void dfs2(int x) {
  dfn[x] = ++bs;
  if (hc[x]) {
    int i;
    top[hc[x]] = top[x];
    dfs2(hc[x]);
    for (i = fir[x]; i; i = nxt[i])
      if ((lj[i] != f[x]) && (lj[i] != hc[x])) dfs2(top[lj[i]] = lj[i]);
  }
}
inline int lca(int x, int y) {
  while (top[x] != top[y])
    if (dep[top[x]] > dep[top[y]])
      x = f[top[x]];
    else
      y = f[top[y]];
  if (dep[x] < dep[y]) return x;
  return y;
}
void qs(int l, int r) {
  int i = l, j = r, m = dfn[a[l + r >> 1]];
  while (i <= j) {
    while (dfn[a[i]] < m) ++i;
    while (dfn[a[j]] > m) --j;
    if (i <= j) swap(a[i++], a[j--]);
  }
  if (i < r) qs(i, r);
  if (l < j) qs(l, j);
}
inline void ins(int x) {
  if (tp == 0) {
    st[tp = 1] = x;
    return;
  }
  ance = lca(st[tp], x);
  while ((tp > 1) && (dep[ance] < dep[st[tp - 1]])) {
    add(st[tp - 1], st[tp]);
    --tp;
  }
  if (dep[ance] < dep[st[tp]]) add(ance, st[tp--]);
  if ((!tp) || (st[tp] != ance)) st[++tp] = ance;
  st[++tp] = x;
}
void dfs3(int x) {
  int i;
  if (siz[x])
    for (i = fir[x]; i; i = nxt[i]) {
      dfs3(lj[i]);
      if (siz[lj[i]]) {
        siz[lj[i]] = 0;
        ++ans;
      }
    }
  else {
    for (i = fir[x]; i; i = nxt[i]) {
      dfs3(lj[i]);
      siz[x] += siz[lj[i]];
      siz[lj[i]] = 0;
    }
    if (siz[x] > 1) {
      ++ans;
      siz[x] = 0;
    }
  }
  fir[x] = 0;
}
int main() {
  read(n);
  for (i = 1; i < n; i++) {
    read(x);
    read(y);
    add(x, y);
    add(y, x);
  }
  bs = 0;
  dfs1(dep[1] = 1);
  dfs2(top[1] = 1);
  memset(fir + 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[f[a[i]]]) {
        puts("-1");
        x = 0;
        break;
      }
    if (!x) {
      while (m) siz[a[m--]] = 0;
      continue;
    }
    ans = 0;
    qs(1, m);
    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);
  }
}
