#include <bits/stdc++.h>
template <typename T>
inline void read(T &x) {
  x = 0;
  char c = getchar();
  bool flag = false;
  while (!isdigit(c)) {
    if (c == '-') flag = true;
    c = getchar();
  }
  while (isdigit(c)) {
    x = (x << 1) + (x << 3) + (c ^ 48);
    c = getchar();
  }
  if (flag) x = -x;
}
using namespace std;
int n, q;
int ans;
struct edge {
  int nxt;
  int to;
} e[501000];
int head[501000], ecnt;
int son[501000], dep[501000], siz[501000], fa[501000];
int top[501000], dfn[501000], dfn_cnt;
int imp[501000];
bool isimp[501000];
int sta[501000], stop;
vector<int> v[501000];
inline void addedge(int from, int to) {
  e[++ecnt] = (edge){head[from], to};
  head[from] = ecnt;
}
void dfs_s(int cur, int faa) {
  fa[cur] = faa;
  siz[cur] = 1;
  dep[cur] = dep[faa] + 1;
  int mx = 0, to;
  for (register int i = head[cur]; i; i = e[i].nxt) {
    to = e[i].to;
    if (to == faa) continue;
    dfs_s(to, cur);
    siz[cur] += siz[to];
    if (siz[to] > mx) {
      mx = siz[to];
      son[cur] = to;
    }
  }
}
void dfs_c(int cur, int topp) {
  top[cur] = topp;
  dfn[cur] = ++dfn_cnt;
  if (!son[cur]) return;
  dfs_c(son[cur], topp);
  int to;
  for (register int i = head[cur]; i; i = e[i].nxt) {
    to = e[i].to;
    if (to == fa[cur] || to == son[cur]) continue;
    dfs_c(to, to);
  }
}
inline int find_lca(int x, int y) {
  while (top[x] != top[y]) {
    if (dep[top[x]] < dep[top[y]]) swap(x, y);
    x = fa[top[x]];
  }
  if (dep[x] < dep[y]) swap(x, y);
  return y;
}
inline void aded(int from, int to) { v[from].push_back(to); }
void ins(int x) {
  if (stop == 1) return sta[++stop] = x, void();
  int lca = find_lca(x, sta[stop]);
  if (lca == sta[stop]) return sta[++stop] = x, void();
  while (stop > 1 && dfn[sta[stop - 1]] >= dfn[lca])
    aded(sta[stop - 1], sta[stop]), stop--;
  if (lca != sta[stop]) aded(lca, sta[stop]), sta[stop] = lca;
  sta[++stop] = x;
}
bool cmp(int x, int y) { return dfn[x] < dfn[y]; }
void dp(int x) {
  if (!v[x].size()) return;
  int cnt = 0;
  for (int i = 0; i < v[x].size(); i++) {
    dp(v[x][i]), cnt += isimp[v[x][i]];
    isimp[v[x][i]] = 0;
  }
  v[x].clear();
  if (isimp[x])
    ans += cnt;
  else if (cnt >= 2)
    ans++;
  else if (cnt)
    isimp[x] = 1;
}
int main() {
  read(n);
  for (int i = 1; i < n; i++) {
    int x, y;
    read(x), read(y);
    addedge(x, y), addedge(y, x);
  }
  dfs_s(1, 0), dfs_c(1, 1);
  int m;
  read(m);
  while (m--) {
    int k;
    read(k);
    for (int i = 1; i <= k; i++) read(imp[i]), isimp[imp[i]] = 1;
    int flag = 0;
    for (int i = 1; i <= k; i++)
      if (isimp[fa[imp[i]]]) {
        flag = 1;
        break;
      }
    if (flag)
      for (int i = 1; i <= k; i++) isimp[imp[i]] = 0;
    if (flag) {
      printf("-1\n");
      continue;
    }
    sort(imp + 1, imp + k + 1, cmp);
    sta[stop = 1] = 1;
    for (int i = 1; i <= k; i++) {
      isimp[imp[i]] = 1;
      if (imp[i] != 1) ins(imp[i]);
    }
    while (stop > 0) aded(sta[stop - 1], sta[stop]), stop--;
    ans = 0, dp(1), isimp[1] = 0;
    printf("%d\n", ans);
  }
  return 0;
}
