#include <bits/stdc++.h>
using namespace std;
const int M = 2e5 + 10;
int res, n, m, top, cnt, tot, id;
int head[M], qhead[M], st[M], dep[M], sz[M], fa[M], dfn[M], son[M], topf[M],
    a[M], vis[M];
struct Edge {
  int next, to;
} edge[M * 2], qedge[M * 2];
void add_edge(int u, int v) {
  edge[++cnt].next = head[u];
  edge[cnt].to = v;
  head[u] = cnt;
}
void add_qedge(int u, int v) {
  qedge[++tot].next = qhead[u];
  qedge[tot].to = v;
  qhead[u] = tot;
}
void dfs1(int u, int f) {
  sz[u] = 1;
  dep[u] = dep[f] + 1;
  for (int i = head[u]; i; i = edge[i].next) {
    int v = edge[i].to;
    if (v == f) continue;
    fa[v] = u;
    dfs1(v, u);
    sz[u] += sz[v];
    if (sz[son[u]] < sz[v]) son[u] = v;
  }
}
void dfs2(int u, int tp) {
  topf[u] = tp;
  dfn[u] = ++id;
  if (son[u]) dfs2(son[u], tp);
  for (int i = head[u]; i; i = edge[i].next) {
    int v = edge[i].to;
    if (v == fa[u] || son[u] == v) continue;
    dfs2(v, v);
  }
}
int LCA(int x, int y) {
  while (topf[x] != topf[y]) {
    if (dep[topf[x]] < dep[topf[y]]) swap(x, y);
    x = fa[topf[x]];
  }
  return dep[x] < dep[y] ? x : y;
}
void insert(int x) {
  if (top == 1) {
    st[++top] = x;
    return;
  }
  int lca = LCA(x, st[top]);
  if (st[top] == lca) {
    st[++top] = x;
    return;
  }
  while (top > 1 && dfn[st[top - 1]] >= dfn[lca])
    add_qedge(st[top - 1], st[top]), top--;
  if (lca != st[top]) add_qedge(lca, st[top]), st[top] = lca;
  st[++top] = x;
}
void dfs3(int u) {
  if (vis[u]) {
    for (int i = qhead[u]; i; i = qedge[i].next) {
      int v = qedge[i].to;
      dfs3(v);
      if (vis[v]) {
        res++;
        vis[v] = 0;
      }
    }
  } else {
    for (int i = qhead[u]; i; i = qedge[i].next) {
      int v = qedge[i].to;
      dfs3(v);
      vis[u] += vis[v];
      vis[v] = 0;
    }
    if (vis[u] > 1) {
      res++;
      vis[u] = 0;
    }
  }
  qhead[u] = 0;
}
bool cmp(int a, int b) { return dfn[a] < dfn[b]; }
int main() {
  scanf("%d", &n);
  for (int i = 1, u, v; i < n; i++) {
    scanf("%d%d", &u, &v);
    add_edge(u, v);
    add_edge(v, u);
  }
  dfs1(1, 0);
  dfs2(1, 1);
  scanf("%d", &m);
  while (m--) {
    int k, flag = 0;
    scanf("%d", &k);
    for (int i = 1; i <= k; i++) scanf("%d", &a[i]), vis[a[i]] = 1;
    for (int i = 1; i <= k; i++) {
      if (vis[fa[a[i]]] == 1) {
        printf("-1\n");
        flag = 1;
        break;
      }
    }
    if (flag)
      for (int i = 1; i <= k; i++) vis[a[i]] = 0;
    else {
      sort(a + 1, a + k + 1, cmp);
      st[top = 1] = 1;
      for (int i = 1; i <= k; i++)
        if (a[i] != 1) insert(a[i]);
      while (top > 1) add_qedge(st[top - 1], st[top]), top--;
      dfs3(1);
      printf("%d\n", res);
      vis[1] = 0;
      tot = 0;
      res = 0;
    }
  }
  return 0;
}
