#include <bits/stdc++.h>
using namespace std;
const int N = 100010;
struct edge {
  int y, nex;
} s[N << 1];
int first[N], len = 0, n, q, dep[N], f[N][20], a[N], dfn[N], tim, sta[N], top,
              g[N][2];
bool tf[N];
vector<int> V[N];
void ins(int x, int y) {
  s[++len] = (edge){y, first[x]};
  first[x] = len;
}
void dfs(int x) {
  dfn[x] = ++tim;
  for (int i = first[x]; i != 0; i = s[i].nex)
    if (s[i].y != f[x][0]) {
      int y = s[i].y;
      f[y][0] = x;
      for (int k = 1; k <= 19; k++) f[y][k] = f[f[y][k - 1]][k - 1];
      dep[y] = dep[x] + 1;
      dfs(y);
    }
}
bool cmp(int x, int y) { return dfn[x] < dfn[y]; }
int lca(int x, int y) {
  if (dep[x] > dep[y]) swap(x, y);
  for (int k = 19; k >= 0; k--)
    if (dep[f[y][k]] >= dep[x]) y = f[y][k];
  if (x == y) return x;
  for (int k = 19; k >= 0; k--)
    if (f[x][k] != f[y][k]) x = f[x][k], y = f[y][k];
  return f[x][0];
}
void gas(int x, int fa) {
  if (tf[x])
    g[x][0] = 1e9, g[x][1] = 0;
  else
    g[x][0] = 0, g[x][1] = 1e9;
  int tmp = 0;
  for (int i = 0; i < V[x].size(); i++) {
    int y = V[x][i];
    gas(y, x);
    g[x][1] = min(min(g[x][0] + g[y][1], g[x][1] + g[y][0]), 1000000000);
    g[x][0] = min(g[x][0] + g[y][0], 1000000000);
    tmp += min(g[y][0], g[y][1]);
    tmp = min(tmp, 1000000000);
  }
  if (!tf[x]) g[x][0] = min(g[x][0], tmp + 1);
  if (!tf[x] || dep[x] - dep[fa] > 1) g[x][0] = min(g[x][0], g[x][1] + 1);
}
int main() {
  scanf("%d", &n);
  int x, y;
  for (int i = 1; i < n; i++) scanf("%d %d", &x, &y), ins(x, y), ins(y, x);
  dep[1] = 1;
  dfs(1);
  scanf("%d", &q);
  while (q--) {
    scanf("%d", &a[0]);
    for (int i = 1; i <= a[0]; i++) scanf("%d", &a[i]);
    sort(a + 1, a + 1 + a[0], cmp);
    sta[top = 1] = 1;
    V[1].resize(0);
    tf[1] = false;
    for (int i = 1; i <= a[0]; i++) {
      tf[a[i]] = true;
      if (a[i] == sta[top]) continue;
      int g = lca(a[i], sta[top]);
      while (dep[sta[top - 1]] >= dep[g])
        V[sta[top - 1]].push_back(sta[top]), top--;
      if (sta[top] != g)
        tf[g] = false, V[g].resize(0), V[g].push_back(sta[top]), sta[top] = g;
      V[a[i]].resize(0);
      sta[++top] = a[i];
    }
    for (int i = top; i > 1; i--) V[sta[i - 1]].push_back(sta[i]);
    gas(1, 0);
    int ans = min(g[1][0], g[1][1]);
    if (ans == 1e9)
      printf("-1\n");
    else
      printf("%d\n", ans);
  }
}
