#include <bits/stdc++.h>
using namespace std;
const int oo = 0x3f3f3f3f;
template <typename T>
inline bool chkmin(T& a, T b) {
  return a > b ? a = b, true : false;
}
template <typename T>
inline bool chkmax(T& a, T b) {
  return a < b ? a = b, true : false;
}
const int maxN = 1e5 + 5;
struct Edge {
  int v, next;
  Edge() {}
  Edge(int v, int next) : v(v), next(next) {}
} G[maxN << 1];
int st[maxN], e;
void addedge(int u, int v) {
  G[++e] = Edge(v, st[u]);
  st[u] = e;
}
int N;
int dfn[maxN], dfs_clock, g[maxN][20], deep[maxN];
void dfs(int u, int fr) {
  dfn[u] = ++dfs_clock;
  g[u][0] = fr;
  deep[u] = deep[fr] + 1;
  for (int i = (1), _end = (18); i <= _end; ++i)
    g[u][i] = g[g[u][i - 1]][i - 1];
  for (int e = st[u]; e; e = G[e].next)
    if (G[e].v != fr) dfs(G[e].v, u);
}
int LCA(int x, int y) {
  if (deep[x] < deep[y]) swap(x, y);
  for (int i = (18), _end = (0); i >= _end; --i)
    if (deep[g[x][i]] >= deep[y]) x = g[x][i];
  if (x == y) return x;
  for (int i = (18), _end = (0); i >= _end; --i)
    if (g[x][i] != g[y][i]) x = g[x][i], y = g[y][i];
  return g[x][0];
}
void PreWork() {
  scanf("%d", &N);
  for (int i = (1), _end = (N - 1); i <= _end; ++i) {
    int u, v;
    scanf("%d%d", &u, &v);
    addedge(u, v);
    addedge(v, u);
  }
  dfs(1, 0);
}
bool cmp(const int& x, const int& y) { return dfn[x] < dfn[y]; }
int M, Key[maxN];
void init() {
  scanf("%d", &M);
  for (int i = (1), _end = (M); i <= _end; ++i) scanf("%d", &Key[i]);
  sort(Key + 1, Key + 1 + M, cmp);
}
int stk[maxN], tp;
bool isKey[maxN];
int f[maxN], HasKey[maxN];
;
inline void update(int u, int v) {
  if (isKey[u]) {
    if (isKey[v]) {
      f[u] += f[v] + 1;
    } else {
      f[u] += f[v] + (HasKey[v] >= 1);
    }
    HasKey[u] = 1;
  } else {
    if (isKey[v]) {
      HasKey[u]++;
      f[u] += f[v];
    } else {
      HasKey[u] += HasKey[v] == 1;
      f[u] += f[v] + (HasKey[v] >= 2);
    }
  }
}
int lover[maxN], fucker = 0;
int Dp() {
  ++fucker;
  for (int i = (1), _end = (M); i <= _end; ++i) {
    lover[Key[i]] = fucker;
    if (lover[g[Key[i]][0]] == fucker) return -1;
  }
  int IdxKey = 1;
  stk[tp = 1] = 1;
  if (Key[1] == 1) {
    isKey[1] = true;
    IdxKey = 2;
    HasKey[1] = 0;
  } else {
    isKey[1] = false;
    HasKey[1] = 0;
  }
  f[1] = 0;
  if (IdxKey <= M) {
    stk[++tp] = Key[IdxKey++];
    isKey[stk[tp]] = true;
    HasKey[stk[tp]] = 0;
    f[stk[tp]] = 0;
  }
  for (int i = (IdxKey), _end = (M); i <= _end; ++i) {
    int u = stk[tp - 1], v = stk[tp], x = Key[i];
    for (int lca = LCA(x, v); dfn[lca] < dfn[v];) {
      if (dfn[lca] <= dfn[u]) {
        update(u, v);
        tp--;
      } else {
        stk[tp] = lca;
        f[lca] = 0;
        HasKey[lca] = 0;
        isKey[lca] = false;
        update(lca, v);
      }
      u = stk[tp - 1];
      v = stk[tp];
    }
    stk[++tp] = x;
    isKey[x] = true;
    HasKey[x] = 0;
    f[x] = 0;
  }
  while (tp > 1) {
    int u = stk[tp - 1], v = stk[tp];
    update(u, v);
    tp--;
  }
  return f[1] + (isKey[1] == false && HasKey[1] >= 2);
}
int main() {
  PreWork();
  int T;
  scanf("%d", &T);
  for (int i = (1), _end = (T); i <= _end; ++i) {
    init();
    printf("%d\n", Dp());
  }
  return 0;
}
