#include <bits/stdc++.h>
using namespace std;
const int MAXN = 200000 + 10;
const char ENDLINE = '\n';
struct Tree {
  struct Edge {
    int v, n;
  } e[MAXN << 1];
  int G[MAXN], edgeCnt;
  int vis[MAXN], tim;
  void _add_edge(int u, int v) {
    if (vis[u] != tim) G[u] = 0, vis[u] = tim;
    e[++edgeCnt].n = G[u];
    G[u] = edgeCnt;
    e[edgeCnt].v = v;
  }
  void add_edge(int u, int v) { _add_edge(u, v), _add_edge(v, u); }
  virtual void init() {
    tim++;
    edgeCnt = 0;
  }
};
struct VirtualTree : public Tree {
  int flag[MAXN], s[MAXN];
  int dfs(int u, int fa = 0) {
    s[u] = 0;
    int res = 0, size = 0;
    for (int i = G[u]; i; i = e[i].n)
      if (e[i].v != fa) {
        res += dfs(e[i].v, u);
        size += s[e[i].v];
      }
    if (flag[u]) {
      s[u] = 1;
      res += size;
    } else {
      if (size > 1)
        res += 1;
      else if (size == 1)
        s[u] = 1;
    }
    return res;
  }
  void clear(int a[], int m) {
    for (int i = 1; i <= m; ++i) flag[a[i]] = false;
  }
} vrtt;
struct OriginalTree : public Tree {
  int dep[MAXN], fa[MAXN], top[MAXN];
  int son[MAXN], size[MAXN];
  int dfn[MAXN], clock, right[MAXN];
  void dfs(int u) {
    size[u] = 1, son[u] = 0;
    for (int i = G[u]; i; i = e[i].n)
      if (e[i].v != fa[u]) {
        fa[e[i].v] = u;
        dep[e[i].v] = dep[u] + 1;
        dfs(e[i].v);
        size[u] += size[e[i].v];
        if (size[son[u]] < size[e[i].v]) son[u] = e[i].v;
      }
  }
  void dfs(int u, int anc) {
    top[u] = anc;
    dfn[u] = ++clock;
    if (son[u]) dfs(son[u], anc);
    for (int i = G[u]; i; i = e[i].n)
      if (e[i].v != fa[u] && e[i].v != son[u]) dfs(e[i].v, e[i].v);
    right[u] = clock;
  }
  int lca(int u, int v) {
    while (top[u] != top[v]) {
      if (dep[top[u]] < dep[top[v]]) swap(u, v);
      u = fa[top[u]];
    }
    return dep[u] < dep[v] ? u : v;
  }
  void init() {
    Tree::init();
    dfs(1);
    dfs(1, 1);
  }
  bool check(int a[], int m) {
    for (int i = 1; i <= m; ++i)
      if (vrtt.flag[fa[a[i]]]) return false;
    return true;
  }
  bool is_in_sub_tree(int u, int p) {
    return dfn[p] <= dfn[u] && dfn[u] <= right[p];
  }
  void build_virtual_tree(int a[], int m) {
    vrtt.init();
    stack<int> st;
    for (int i = 1; i <= m; ++i) {
      int u = a[i];
      while (!st.empty() && !is_in_sub_tree(u, st.top())) st.pop();
      if (!st.empty()) vrtt.add_edge(st.top(), u);
      st.push(u);
    }
  }
  int solve(int a[], int m) {
    for (int i = 1; i <= m; ++i) vrtt.flag[a[i]] = true;
    if (!check(a, m)) {
      vrtt.clear(a, m);
      return -1;
    }
    bool cmp(int, int);
    sort(a + 1, a + 1 + m, cmp);
    for (int i = m; i > 1; --i) a[++m] = lca(a[i], a[i - 1]);
    sort(a + 1, a + 1 + m, cmp);
    m = unique(a + 1, a + 1 + m) - a - 1;
    build_virtual_tree(a, m);
    int res = vrtt.dfs(a[1]);
    vrtt.clear(a, m);
    return res;
  }
} orgt;
bool cmp(int a, int b) { return orgt.dfn[a] < orgt.dfn[b]; }
int main() {
  int n, m, q;
  static int a[MAXN];
  ios::sync_with_stdio(0);
  cin >> n;
  for (int i = 1; i < n; ++i) {
    int u, v;
    cin >> u >> v;
    orgt.add_edge(u, v);
  }
  cin >> q;
  orgt.init();
  while (q--) {
    cin >> m;
    for (int i = 1; i <= m; ++i) cin >> a[i];
    cout << orgt.solve(a, m) << ENDLINE;
  }
}
