#include <bits/stdc++.h>
using namespace std;
const int N = 101000;
inline int read() {
  register int x = 0, f = 0;
  register char c = getchar();
  while (c < '0' || c > '9') f |= c == '-', c = getchar();
  while (c >= '0' && c <= '9') x = (x << 3) + (x << 1) + c - '0', c = getchar();
  return f ? -x : x;
}
int n, cnt, id, top, ans;
int head[N], dfn[N], a[N], f[N][18], sta[N], d[N], siz[N];
vector<int> ed[N];
struct edge {
  int v, nex;
} e[N << 1];
inline void add(int u, int v) {
  e[++cnt].v = v;
  e[cnt].nex = head[u];
  head[u] = cnt;
  return;
}
inline bool cmp(const int &A, const int &B) { return dfn[A] < dfn[B]; }
inline void addc(int u, int v) {
  ed[v].push_back(u);
  return;
}
void dfs(int x, int fa) {
  dfn[x] = ++id;
  d[x] = d[fa] + 1;
  for (int i = 1; i <= 17; ++i) f[x][i] = f[f[x][i - 1]][i - 1];
  for (int i = head[x], v; i; i = e[i].nex) {
    v = e[i].v;
    if (v == fa) continue;
    f[v][0] = x;
    dfs(v, x);
  }
  return;
}
int LCA(int x, int y) {
  if (x == y) return x;
  int i;
  if (d[x] < d[y]) swap(x, y);
  for (i = 17; i >= 0; --i)
    if (d[f[x][i]] >= d[y]) x = f[x][i];
  if (x == y) return x;
  for (i = 17; i >= 0; --i)
    if (f[x][i] ^ f[y][i]) x = f[x][i], y = f[y][i];
  return f[x][0];
}
void build_tree(int k) {
  top = 0;
  int i = 1;
  if (a[1] != 1) sta[top = 1] = 1;
  for (i = 1; i <= k; ++i) {
    int p = LCA(sta[top], a[i]);
    if (p == sta[top]) {
      sta[++top] = a[i];
      continue;
    }
    while (top > 1 && d[sta[top - 1]] >= d[p])
      addc(sta[top], sta[top - 1]), top--;
    if (sta[top] != p) addc(sta[top], p), sta[top] = p;
    sta[++top] = a[i];
  }
  while (top > 1) addc(sta[top], sta[top - 1]), top--;
  return;
}
void dfs2(int x, int f) {
  int i = 0, s = ed[x].size(), v;
  if (siz[x]) {
    for (i = 0; i < s; ++i) {
      v = ed[x][i];
      if (v == f) continue;
      dfs2(v, x);
      if (siz[v]) {
        ans++;
        siz[v] = 0;
      }
    }
  } else {
    for (i = 0; i < s; ++i) {
      v = ed[x][i];
      if (v == f) continue;
      dfs2(v, x);
      siz[x] += siz[v];
      siz[v] = 0;
    }
    if (siz[x] > 1) siz[x] = 0, ans++;
  }
  ed[x].clear();
  return;
}
int main() {
  n = read();
  for (int i = 1, a, b; i < n; ++i) {
    a = read(), b = read();
    add(a, b);
    add(b, a);
  }
  dfs(1, 0);
  int m = read(), k, i, j;
  for (i = 1; i <= m; ++i) {
    k = read();
    for (j = 1; j <= k; ++j) a[j] = read(), siz[a[j]] = 1;
    sort(a + 1, a + 1 + k, cmp);
    for (j = 1; j <= k; ++j)
      if (siz[f[a[j]][0]]) break;
    if (j <= k) {
      puts("-1");
      for (j = 1; j <= k; ++j) siz[a[j]] = 0;
      continue;
    }
    build_tree(k);
    ans = 0;
    dfs2(1, 0);
    printf("%d\n", ans);
    siz[1] = 0;
    ed[1].clear();
  }
  return 0;
}
