#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100100, MAXB = 20;
int cnt, m, ldfn[MAXN * 2], rdfn[MAXN * 2], fa[MAXN * 2][MAXB * 2],
    dep[MAXN * 2], stk[MAXN * 2], d[MAXN * 2], vis[MAXN * 2], ans[MAXN * 2],
    siz[MAXN * 2];
vector<int> rea[MAXN * 2], vir[MAXN * 2];
void predfs(int x, int f, int depth) {
  ldfn[x] = ++cnt;
  dep[x] = depth;
  fa[x][0] = f;
  for (int j = 1; j < MAXB; j++) {
    fa[x][j] = fa[fa[x][j - 1]][j - 1];
  }
  for (int i = 0; i < rea[x].size(); i++) {
    int son = rea[x][i];
    if (son != f) predfs(son, x, depth + 1);
  }
  rdfn[x] = cnt;
}
int lca(int u, int v) {
  if (dep[u] < dep[v]) swap(u, v);
  int delta = dep[u] - dep[v];
  for (int j = 0; j < MAXB && delta; j++) {
    if (delta & (1 << j)) u = fa[u][j];
  }
  if (u == v) return u;
  for (int j = MAXB - 1; j >= 0; j--) {
    if (fa[u][j] != fa[v][j]) {
      u = fa[u][j];
      v = fa[v][j];
    }
  }
  return fa[u][0];
}
bool cmp(int x, int y) { return ldfn[x] < ldfn[y]; }
void build() {
  sort(d + 1, d + m + 1, cmp);
  int keynum = m;
  for (int i = 1; i < keynum; i++) d[++m] = lca(d[i], d[i + 1]);
  sort(d + 1, d + m + 1, cmp);
  m = unique(d + 1, d + m + 1) - 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 = 1; 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;
    predfs(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 flag = 1;
      for (int i = 1; i <= m; i++) {
        if (vis[fa[d[i]][0]]) {
          flag = 0;
          break;
        }
      }
      if (!flag) {
        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();
      }
    }
  }
}
