#include <bits/stdc++.h>
const int oo = 2139063143;
const int N = 1010000;
const int mod = 1000000007;
using namespace std;
inline void sc(int &x) {
  x = 0;
  static int p;
  p = 1;
  static char c;
  c = getchar();
  while (!isdigit(c)) {
    if (c == '-') p = -1;
    c = getchar();
  }
  while (isdigit(c)) {
    x = (x << 1) + (x << 3) + (c - 48);
    c = getchar();
  }
  x *= p;
}
int n;
struct EDGE {
  int v, nx;
} lb[N << 1];
int tot = 1, top[N];
void add(int u, int v) { lb[++tot].v = v, lb[tot].nx = top[u], top[u] = tot; }
int dep[N], fa[N][20], dfn[N];
void dfs(int u, int faa) {
  dep[u] = dep[faa] + 1;
  fa[u][0] = faa;
  dfn[u] = ++dfn[0];
  for (int kb = top[u]; kb != -1; kb = lb[kb].nx) {
    int v = lb[kb].v;
    if (v == faa) continue;
    dfs(v, u);
  }
}
void init() {
  for (int j = 1; j <= 18; j++)
    for (int i = 1; i <= n; i++) fa[i][j] = fa[fa[i][j - 1]][j - 1];
}
int lca(int x, int y) {
  if (dep[x] < dep[y]) swap(x, y);
  for (int i = 18; i >= 0; i--)
    if (dep[fa[x][i]] >= dep[y]) x = fa[x][i];
  if (x == y) return x;
  for (int i = 18; i >= 0; i--)
    if (fa[x][i] != fa[y][i]) x = fa[x][i], y = fa[y][i];
  return fa[x][0];
}
vector<int> e[N];
void adde(int u, int v) { e[u].push_back(v); }
bool key[N], fg;
int f[N], g[N];
int c[N];
void solve(int u) {
  c[++c[0]] = u;
  for (int i = 0; i < (int)e[u].size(); i++) {
    int v = e[u][i];
    solve(v);
    f[u] += f[v], g[u] += g[v];
  }
  if (key[u])
    f[u] += g[u], g[u] = 1;
  else
    f[u] += (g[u] > 1), g[u] = (g[u] == 1);
  e[u].clear();
}
int st[N], he;
void ins(int u) {
  if (u == 1) return;
  int z = lca(st[he], u);
  while (dep[z] < dep[st[he]]) {
    if (dep[z] >= dep[st[he - 1]]) {
      adde(z, st[he]), --he;
      if (st[he] != z) st[++he] = z;
      break;
    }
    adde(st[he - 1], st[he]), --he;
  }
  if (st[he] != u) st[++he] = u;
}
int q[N];
bool ly(int A, int B) { return dfn[A] < dfn[B]; }
int main() {
  memset(top, -1, sizeof(top));
  sc(n);
  for (int i = 1; i < n; i++) {
    int u, v;
    sc(u), sc(v);
    add(u, v), add(v, u);
  }
  dfs(1, 0);
  init();
  int G;
  sc(G);
  while (G--) {
    int k;
    sc(k);
    for (int i = 1; i <= k; i++) sc(q[i]), key[q[i]] = 1;
    sort(q + 1, q + k + 1, ly);
    st[he = 1] = 1;
    for (int i = 1; i <= k; i++) ins(q[i]);
    while (he > 1) adde(st[he - 1], st[he]), he--;
    solve(1);
    fg = 1;
    for (int i = 1; i <= k; i++)
      if (key[q[i]] && key[fa[q[i]][0]]) fg = 0;
    printf("%d\n", fg ? f[1] : -1);
    for (int i = 1; i <= k; i++) key[q[i]] = 0;
    while (c[0]) f[c[c[0]]] = g[c[c[0]]] = 0, --c[0];
  }
  return 0;
}
