#include <bits/stdc++.h>
using namespace std;
int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch - '0' < 0 || ch - '0' > 9) {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch - '0' >= 0 && ch - '0' <= 9) {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
int n, K;
int head[100010], nxt[100010 * 2], to[100010 * 2], tot;
void add(int u, int v) {
  tot++;
  nxt[tot] = head[u];
  head[u] = tot;
  to[tot] = v;
}
int up[100010][22], dep[100010], dfn[100010], cnt_dfn;
void dfs(int x, int las) {
  dfn[x] = ++cnt_dfn;
  for (int i = head[x]; i; i = nxt[i]) {
    if (to[i] == las) continue;
    up[to[i]][0] = x;
    dep[to[i]] = dep[x] + 1;
    dfs(to[i], x);
  }
}
int LCA(int x, int y) {
  if (dep[x] < dep[y]) swap(x, y);
  for (int i = 20; i >= 0; i--)
    if (dep[y] + (1 << i) <= dep[x]) x = up[x][i];
  if (x == y) return x;
  for (int i = 20; i >= 0; i--)
    if (up[x][i] != up[y][i]) x = up[x][i], y = up[y][i];
  return up[x][0];
}
int p[100010], book[100010], s[100010], top;
vector<int> e[100010];
void addx(int u, int v) {
  if (u == v) return;
  e[u].push_back(v);
}
bool cmp(int x, int y) { return dfn[x] < dfn[y]; }
bool Build_Tree() {
  sort(p + 1, p + K + 1, cmp);
  for (int i = 1; i <= K; i++) book[p[i]] = 1;
  int flag = 0;
  for (int i = 1; i <= K; i++)
    if (book[up[p[i]][0]]) flag = 1;
  if (flag) {
    for (int i = 1; i <= K; i++) book[p[i]] = 0;
    return false;
  }
  s[top = 1] = 1;
  for (int i = 1; i <= K; i++) {
    int x = p[i], lca = LCA(x, s[top]);
    if (lca == s[top]) {
      s[++top] = x;
      continue;
    }
    while (top && dep[s[top - 1]] > dep[lca]) {
      addx(s[top - 1], s[top]);
      top--;
    }
    addx(lca, s[top]);
    top--;
    if (s[top] != lca) s[++top] = lca;
    s[++top] = x;
  }
  while (top > 1) addx(s[top - 1], s[top]), top--;
  top = 0;
  return true;
}
int f[100010], g[100010];
void dfs(int x) {
  f[x] = g[x] = 0;
  int cnt = 0;
  for (int i = 0; i < e[x].size(); i++) {
    int to = e[x][i];
    dfs(to);
    f[x] += f[to];
    cnt += g[to];
  }
  if (book[x])
    f[x] += cnt, g[x] = 1;
  else if (cnt >= 2)
    f[x]++, g[x] = 0;
  else
    g[x] = cnt;
}
void reco(int x) {
  book[x] = 0;
  for (int i = 0; i < e[x].size(); i++) reco(e[x][i]);
  e[x].clear();
}
int main() {
  n = read();
  for (int i = 1; i < n; i++) {
    int x = read(), y = read();
    add(x, y);
    add(y, x);
  }
  dfs(1, 0);
  for (int j = 1; j <= 20; j++)
    for (int i = 1; i <= n; i++) up[i][j] = up[up[i][j - 1]][j - 1];
  int m = read();
  while (m--) {
    K = read();
    for (int i = 1; i <= K; i++) p[i] = read();
    if (!Build_Tree()) {
      puts("-1");
      continue;
    }
    dfs(1);
    printf("%d\n", f[1]);
    reco(1);
  }
  return 0;
}
