#include <bits/stdc++.h>
using namespace std;
struct EDGE {
  int to, next;
} e[200010], e1[200010];
int head[100010], top;
int head1[100010], top1;
void add(int u, int v) {
  e[top].to = v;
  e[top].next = head[u];
  head[u] = top++;
}
set<int> ver;
void add1(int u, int v) {
  ver.insert(u);
  e1[top1].to = v;
  e1[top1].next = head1[u];
  head1[u] = top1++;
}
vector<int> vec;
int tag[100010];
int fa[100010], sz[100010], h[100010], dep[100010];
void dfs(int x) {
  sz[x] = 1;
  int i;
  for (i = head[x]; ~i; i = e[i].next) {
    if (e[i].to == fa[x]) continue;
    fa[e[i].to] = x;
    dep[e[i].to] = dep[x] + 1;
    dfs(e[i].to);
    if (sz[e[i].to] > sz[h[x]]) h[x] = e[i].to;
    sz[x] += sz[e[i].to];
  }
}
int c[100010], dfn[100010], clk;
void dfs1(int x) {
  dfn[x] = ++clk;
  if (!h[x]) return;
  c[h[x]] = c[x];
  dfs1(h[x]);
  int i;
  for (i = head[x]; ~i; i = e[i].next) {
    if (e[i].to == fa[x]) continue;
    if (e[i].to == h[x]) continue;
    c[e[i].to] = e[i].to;
    dfs1(e[i].to);
  }
}
int lca(int x, int y) {
  while (c[x] != c[y]) {
    if (dep[c[x]] > dep[c[y]])
      x = fa[c[x]];
    else
      y = fa[c[y]];
  }
  if (dep[x] < dep[y]) return x;
  return y;
}
bool cmp(const int &x, const int &y) { return dfn[x] < dfn[y]; }
deque<int> q;
void insert(int x) {
  if (q.empty()) {
    q.push_back(x);
    return;
  }
  if (lca(q.back(), x) == q.back()) {
    q.push_back(x);
    return;
  }
  int lst;
  while (1) {
    lst = q.back();
    q.pop_back();
    if (q.empty()) {
      q.push_back(lca(lst, x));
      add1(q.back(), lst);
      add1(lst, q.back());
      break;
    } else {
      if (lca(q.back(), x) == q.back()) {
        if (lca(lst, x) != q.back()) q.push_back(lca(lst, x));
        add1(q.back(), lst);
        add1(lst, q.back());
        break;
      } else {
        add1(q.back(), lst);
        add1(lst, q.back());
      }
    }
  }
  q.push_back(x);
}
int id;
int ans;
int g[100010];
void dfs2(int x, int fa = 0) {
  int i;
  if (tag[x] == id) {
    for (i = head1[x]; ~i; i = e1[i].next) {
      if (e1[i].to == fa) continue;
      dfs2(e1[i].to, x);
      if (g[e1[i].to]) ++ans;
    }
    g[x] = 1;
  } else {
    int cnt = 0;
    for (i = head1[x]; ~i; i = e1[i].next) {
      if (e1[i].to == fa) continue;
      dfs2(e1[i].to, x);
      if (g[e1[i].to]) ++cnt;
    }
    if (cnt >= 2) {
      ++ans;
      g[x] = 0;
    } else {
      if (cnt == 1)
        g[x] = 1;
      else
        g[x] = 0;
    }
  }
}
int main() {
  memset(head, 255, sizeof(head));
  memset(head1, 255, sizeof(head1));
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  int i;
  int u, v;
  for (i = 1; i < n; ++i) {
    cin >> u >> v;
    add(u, v);
    add(v, u);
  }
  dep[1] = 1;
  dfs(1);
  c[1] = 1;
  dfs1(1);
  int m;
  cin >> m;
  int k, j;
  for (i = 1; i <= m; ++i) {
    id = i;
    cin >> k;
    vec.resize(k);
    for (j = 0; j < k; ++j) {
      cin >> vec[j];
      tag[vec[j]] = i;
    }
    bool flag = 0;
    for (j = 0; j < k; ++j) {
      if (tag[fa[vec[j]]] == i) flag = 1;
    }
    if (flag) {
      cout << -1 << '\n';
      continue;
    }
    sort(vec.begin(), vec.end(), cmp);
    for (j = 0; j < k; ++j) insert(vec[j]);
    int lst;
    while (q.size() > 1) {
      lst = q.back();
      q.pop_back();
      add1(lst, q.back());
      add1(q.back(), lst);
    }
    q.clear();
    ans = 0;
    dfs2(vec[0]);
    cout << ans << '\n';
    set<int>::iterator it;
    for (it = ver.begin(); it != ver.end(); ++it) head1[*it] = -1, g[*it] = 0;
    ver.clear();
  }
  return 0;
}
