#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
vector<int> link[N];
int head[N], nxt[N], ver[N], tot, st[N], top;
int fa[N][20], n, q, m, ans, d[N], si[N], dep[N], dfn[N], cnt;
bool cmp(int a, int b) { return dfn[a] < dfn[b]; }
void dfs(int u, int fu) {
  fa[u][0] = fu;
  dep[u] = dep[fu] + 1;
  dfn[u] = ++cnt;
  for (int i = 1; i < 20; i++) fa[u][i] = fa[fa[u][i - 1]][i - 1];
  int size = link[u].size();
  for (int i = 0; i < size; i++) {
    int v = link[u][i];
    if (v != fu) dfs(v, u);
  }
}
int lca(int x, int y) {
  if (dep[x] > dep[y]) swap(x, y);
  for (int i = 19; i >= 0; i--)
    if (dep[fa[y][i]] >= dep[x]) y = fa[y][i];
  if (x == y) return x;
  for (int i = 19; i >= 0; i--)
    if (fa[x][i] != fa[y][i]) x = fa[x][i], y = fa[y][i];
  return fa[x][0];
}
void add(int u, int v) { ver[++tot] = v, nxt[tot] = head[u], head[u] = tot; }
void build(int x) {
  if (!top) {
    st[++top] = x;
    return;
  }
  int lc = lca(x, st[top]);
  while (top > 1 && dep[lc] < dep[st[top - 1]])
    add(st[top - 1], st[top]), top--;
  if (dep[st[top]] > dep[lc]) add(lc, st[top]), top--;
  if (top == 0 || st[top] != lc) st[++top] = lc;
  st[++top] = x;
}
void solve(int u) {
  int cnt = 0;
  for (int i = head[u], v; i; i = nxt[i]) {
    v = ver[i];
    solve(v);
    if (si[v]) cnt++;
  }
  if (si[u] && cnt) ans += cnt;
  if (!si[u]) {
    if (cnt == 1)
      si[u] = 1;
    else if (cnt > 1)
      ans++;
  }
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i < n; i++) {
    int u, v;
    scanf("%d%d", &u, &v);
    link[u].push_back(v);
    link[v].push_back(u);
  }
  dfs(1, 0);
  scanf("%d", &q);
  while (q--) {
    scanf("%d", &m);
    memset(si, 0, sizeof(si));
    for (int i = 1; i <= m; i++) scanf("%d", &d[i]);
    sort(d + 1, d + 1 + m, cmp);
    bool end = 0;
    for (int i = 1; i <= m; i++) {
      if (si[fa[d[i]][0]]) {
        end = 1;
        puts("-1");
        break;
      }
      si[d[i]] = 1;
    }
    if (end) continue;
    memset(head, 0, sizeof(head));
    top = ans = tot = 0;
    if (d[1] != 1) st[++top] = 1;
    for (int i = 1; i <= m; i++) build(d[i]);
    while (top > 1) add(st[top - 1], st[top]), top--;
    solve(1);
    printf("%d\n", ans);
  }
  return 0;
}
