#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 100;
int cnt, m;
int ldfn[MAXN], rdfn[MAXN], fa[MAXN][20], dep[MAXN], stk[MAXN], d[MAXN],
    vis[MAXN];
vector<int> rea[MAXN], vir[MAXN];
int ans[MAXN], siz[MAXN];
void QAQ(int x, int f, int depth) {
  ldfn[x] = ++cnt;
  dep[x] = depth;
  fa[x][0] = f;
  for (int i = 1; i < 20; i++) fa[x][i] = fa[fa[x][i - 1]][i - 1];
  for (int i = 0; i < rea[x].size(); i++)
    if (rea[x][i] != f) QAQ(rea[x][i], x, depth + 1);
  rdfn[x] = cnt;
}
int LCA(int x, int y) {
  if (dep[x] < dep[y]) swap(x, y);
  int delta = dep[x] - dep[y];
  for (int i = 0; i < 20 && delta; i++)
    if (delta & (1 << i)) x = fa[x][i];
  if (x == y) return x;
  for (int i = 19; i >= 0; i--)
    if (fa[x][i] != fa[y][i]) {
      x = fa[x][i];
      y = fa[y][i];
    }
  return fa[x][0];
}
bool cmp(int x, int y) { return ldfn[x] < ldfn[y]; }
void build() {
  sort(d + 1, d + 1 + m, cmp);
  int keynum = m;
  for (int i = 1; i < keynum; i++) d[++m] = LCA(d[i], d[i + 1]);
  sort(d + 1, d + 1 + m, cmp);
  m = unique(d + 1, d + 1 + m) - d - 1;
  int top = 0;
  stk[++top] = d[1];
  for (int i = 2; i <= m; i++) {
    while (top && rdfn[stk[top]] < ldfn[d[i]]) top--;
    if (top) vir[stk[top]].push_back(d[i]);
    stk[++top] = d[i];
  }
}
void dfs(int x) {
  ans[x] = 0;
  if (vis[x]) {
    siz[x] = 1;
    for (int i = 0; i < vir[x].size(); i++) {
      int son = vir[x][i];
      dfs(son);
      ans[x] += ans[son];
      if (siz[son]) ans[x]++;
    }
  } else {
    siz[x] = 0;
    for (int i = 0; i < vir[x].size(); i++) {
      int son = vir[x][i];
      dfs(son);
      ans[x] += ans[son];
      siz[x] += siz[son];
    }
    if (siz[x] > 1) {
      siz[x] = 0;
      ans[x]++;
    }
  }
}
int main() {
  int n, q, u, v;
  while (~scanf("%d", &n)) {
    for (int i = 0; i <= n; i++) rea[i].clear();
    for (int i = 1; i < n; i++) {
      scanf("%d%d", &u, &v);
      rea[u].push_back(v);
      rea[v].push_back(u);
    }
    cnt = 0;
    QAQ(1, 0, 0);
    scanf("%d", &q);
    while (q--) {
      scanf("%d", &m);
      for (int i = 1; i <= m; i++) {
        scanf("%d", &d[i]);
        vis[d[i]] = 1;
      }
      int fl = 1;
      for (int i = 1; i <= m; i++)
        if (vis[fa[d[i]][0]]) {
          fl = 0;
          break;
        }
      if (!fl)
        puts("-1");
      else {
        build();
        dfs(d[1]);
        printf("%d\n", ans[d[1]]);
      }
      for (int i = 1; i <= m; i++) vis[d[i]] = 0, vir[d[i]].clear();
    }
  }
}
