#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int x = 0;
  char ch = getchar();
  while (ch < '0' || ch > '9') ch = getchar();
  while (ch >= '0' && ch <= '9') x = x * 10 + ch - '0', ch = getchar();
  return x;
}
struct Tree {
  int head[100005], to[100005 << 1], next[100005 << 1], cnt;
  inline void addedge(int x, int y) {
    to[++cnt] = y, next[cnt] = head[x], head[x] = cnt;
  }
  int dep[100005], dfn[100005], fa[100005], size[100005], son[100005],
      top[100005];
  void dfs1(int x) {
    dfn[x] = ++cnt;
    size[x] = 1;
    for (int i = head[x]; i; i = next[i]) {
      register int t = to[i];
      if (!dep[t]) {
        dep[t] = dep[x] + 1;
        fa[t] = x;
        dfs1(t);
        size[x] += size[t];
        if (size[t] > size[son[x]]) son[x] = t;
      }
    }
  }
  void dfs2(int x) {
    for (int i = head[x]; i; i = next[i]) {
      register int t = to[i];
      if (dep[x] + 1 == dep[t]) {
        top[t] = t == son[x] ? top[x] : t;
        dfs2(t);
      }
    }
  }
  void build(int n) {
    addedge(1, 2);
    for (int i = 1; i < n; i++) {
      register int x = read() + 1, y = read() + 1;
      addedge(x, y), addedge(y, x);
    }
    cnt = 0, dep[1] = 1, dfs1(1);
    top[1] = 1, dfs2(1);
  }
  inline int lca(int x, int y) {
    while (top[x] != top[y]) {
      if (dep[top[x]] > dep[top[y]])
        x = fa[top[x]];
      else
        y = fa[top[y]];
    }
    return dep[x] < dep[y] ? x : y;
  }
  int st[100005], Ans;
  bool mark[100005];
  inline bool dfs(int x) {
    if (mark[x]) {
      for (int i = head[x]; i; i = next[i])
        if (dfs(to[i])) Ans++;
      return 1;
    } else {
      register int c = 0;
      for (int i = head[x]; i; i = next[i]) c += dfs(to[i]);
      if (c > 1) {
        Ans++;
        return 0;
      } else
        return c;
    }
  }
  void solve(int *node, int n) {
    for (int i = 0; i < n; i++) mark[node[i]] = true;
    for (int i = 0; i < n; i++)
      if (mark[fa[node[i]]]) {
        for (int i = 0; i < n; i++) mark[node[i]] = false;
        puts("-1");
        return;
      }
    int top = 1;
    head[st[1] = 1] = cnt = 0;
    for (int i = 0; i < n; i++) {
      register int x = lca(node[i], st[top]);
      for (; dep[x] < dep[st[top]]; top--) {
        if (dep[x] <= dep[st[top - 1]])
          addedge(st[top - 1], st[top]);
        else {
          head[x] = 0;
          addedge(x, st[top]);
          st[top++] = x;
        }
      }
      st[++top] = node[i];
      head[node[i]] = 0;
    }
    for (top--; top; top--) addedge(st[top], st[top + 1]);
    Ans = 0, dfs(1), printf("%d\n", Ans);
    for (int i = 0; i < n; i++) mark[node[i]] = false;
  }
} tree;
int a[100005];
bool cmp(int &x, int &y) { return tree.dfn[x] < tree.dfn[y]; }
int main() {
  int n = read();
  tree.build(n);
  for (int m = read(); m--;) {
    n = read();
    for (int i = 0; i < n; i++) a[i] = read() + 1;
    sort(a, a + n, cmp);
    tree.solve(a, n);
  }
  return 0;
}
