#include <bits/stdc++.h>
using namespace std;
struct data {
  int obj, pre, c;
} e[100500 * 2];
int head[100500], bin[22], idx, tot, dep[100500], n, m, fa[100500][22],
    st[100500], ed[100500], a[100500], q[100500], mark[100500], top;
long long f[100500][2];
void insert(int x, int y, int c) {
  e[++tot].obj = y;
  e[tot].pre = head[x];
  head[x] = tot;
  e[tot].c = c;
}
long long read() {
  long long x = 0, f = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
void dfs(int u, int f) {
  st[u] = ++idx;
  for (int i = 1; i <= 20; i++)
    if (dep[u] >= bin[i]) fa[u][i] = fa[fa[u][i - 1]][i - 1];
  for (int j = head[u]; j; j = e[j].pre) {
    int v = e[j].obj;
    if (v == f) continue;
    fa[v][0] = u;
    dep[v] = dep[u] + 1;
    dfs(v, u);
  }
  ed[u] = idx;
}
int lca(int x, int y) {
  if (dep[x] < dep[y]) swap(x, y);
  int t = dep[x] - dep[y];
  for (int i = 20; i >= 0; i--)
    if (t & bin[i]) x = fa[x][i];
  for (int i = 20; i >= 0; i--)
    if (fa[x][i] != fa[y][i]) x = fa[x][i], y = fa[y][i];
  if (x == y) return x;
  return fa[x][0];
}
bool cmp(int x, int y) { return st[x] < st[y]; }
int dis(int x, int y) { return dep[y] - dep[x]; }
void dp(int u) {
  for (int j = head[u]; j; j = e[j].pre) {
    int v = e[j].obj;
    dp(v);
    if (f[v][0] >= 100000000 && f[v][1] >= 100000000) {
      f[u][0] = f[u][1] = 100000000;
      return;
    }
  }
  if (!mark[u]) {
    long long x1, x0, mn = 2 * 100000000, sum = 0, don = 0, deg = 0;
    for (int j = head[u]; j; j = e[j].pre) {
      int v = e[j].obj;
      deg++;
      x0 = min(f[v][0], e[j].c > 1 ? 1 + min(f[v][0], f[v][1]) : 100000000);
      don += x0;
      x1 = f[v][1];
      sum += x1;
      mn = min(mn, x1 - x0);
    }
    if (deg == 0)
      f[u][0] = f[u][1] = 0;
    else {
      f[u][0] = min(1 + sum, don);
      f[u][1] = min(f[u][0], don + mn);
    }
  } else {
    long long sum = 0;
    f[u][0] = 100000000;
    for (int j = head[u]; j; j = e[j].pre) {
      int v = e[j].obj;
      long long x = f[v][0];
      if (e[j].c > 1) x = min(f[v][0], min(f[v][0], f[v][1]) + 1);
      if (x >= 100000000) {
        f[u][1] = 100000000;
        return;
      }
      sum += x;
    }
    f[u][1] = sum;
  }
}
int main() {
  bin[0] = 1;
  for (int i = 1; i <= 20; i++) bin[i] = bin[i - 1] * 2;
  n = read();
  for (int i = 1; i <= n - 1; i++) {
    int x = read(), y = read();
    insert(x, y, 0);
    insert(y, x, 0);
  }
  dfs(1, 0);
  m = read();
  tot = 0;
  memset(head, 0, sizeof(head));
  for (int o = 1; o <= m; o++) {
    int s = read(), sum = s;
    for (int i = 1; i <= s; i++) a[i] = read(), mark[a[i]] = 1;
    sort(a + 1, a + 1 + s, cmp);
    q[top = 1] = 1;
    int cnt = 0;
    if (a[1] == 1)
      cnt = 2;
    else
      a[++sum] = 1, cnt = 1;
    for (int i = cnt; i <= s; i++) {
      int f = lca(a[i], q[top]);
      while (top) {
        if (top > 1 && dep[f] < dep[q[top - 1]])
          insert(q[top - 1], q[top], dis(q[top - 1], q[top])), top--;
        else if (dep[f] < dep[q[top]]) {
          insert(f, q[top], dis(f, q[top])), top--;
          break;
        } else
          break;
      }
      if (f != q[top]) q[++top] = f, a[++sum] = f;
      q[++top] = a[i];
    }
    while (top > 1) insert(q[top - 1], q[top], dis(q[top - 1], q[top])), top--;
    dp(1);
    if (f[1][0] >= 100000000 && f[1][1] >= 100000000)
      puts("-1");
    else
      printf("%lld\n", min(f[1][0], f[1][1]));
    for (int i = 1; i <= sum; i++) mark[a[i]] = 0, head[a[i]] = 0;
    tot = 0;
  }
  return 0;
}
