#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:100000000")
using namespace std;
int p[20][100100], u[100100], h[100100], a[100100], v[100100];
vector<int> m[100100];
void up(int &i, int x) {
  int k;
  for (k = 20 - 1; k >= 0; k--)
    if (h[p[k][i]] >= x) i = p[k][i];
}
int lca(int i, int j) {
  int k;
  up(i, h[j]);
  up(j, h[i]);
  if (i == j) return i;
  for (k = 20 - 1; k >= 0; k--)
    if (p[k][i] != p[k][j]) {
      i = p[k][i];
      j = p[k][j];
    }
  return p[0][i];
}
int f1[100100], f2[100100], c;
void dfs(int i) {
  int j;
  u[i] = 1;
  f1[i] = c;
  c++;
  for (j = 0; j < m[i].size(); j++)
    if (!u[m[i][j]]) {
      p[0][m[i][j]] = i;
      h[m[i][j]] = h[i] + 1;
      dfs(m[i][j]);
    }
  f2[i] = c;
}
int high(int i, int j) {
  int l = lca(i, j);
  if (l == i || l == j)
    return h[l] + 1;
  else
    return h[l];
}
int z;
pair<int, pair<int, int> > e[100100];
bool dfs2(int i) {
  int j, k;
  u[i] = 1;
  k = 0;
  for (j = 0; j < m[i].size(); j++)
    if (!u[m[i][j]]) k += dfs2(m[i][j]);
  if (v[i]) {
    z += k;
    return 1;
  } else if (k > 1) {
    z++;
    return 0;
  } else
    return k;
}
int main() {
  int n, k, q, i, j;
  for (scanf("%d", &n), k = n - 1; k--;
       scanf("%d%d", &i, &j), i--, j--, m[i].push_back(j), m[j].push_back(i))
    ;
  dfs(0);
  for (k = 1; k < 20; k++)
    for (i = 0; i < n; p[k][i] = p[k - 1][p[k - 1][i]], i++)
      ;
  for (i = 0; i < n; u[i] = 0, i++)
    ;
  for (scanf("%d", &q); q--;) {
    scanf("%d", &k);
    for (i = 0; i < k; scanf("%d", &a[i]), a[i]--, v[a[i]] = 1, i++)
      ;
    for (i = 0; i < k; i++)
      if (a[i] > 0 && v[p[0][a[i]]]) break;
    if (i < k)
      z = -1;
    else if (k > 100) {
      z = 0;
      dfs2(0);
      for (i = 0; i < n; u[i] = 0, i++)
        ;
    } else {
      z = 0;
      int l = 0;
      for (i = 0; i < k; i++)
        for (j = i + 1; j < k;
             e[l++] = make_pair(high(a[i], a[j]), make_pair(a[i], a[j])), j++)
          ;
      sort(e, e + l);
      for (l--; l >= 0; l--) {
        i = e[l].second.first;
        j = e[l].second.second;
        if (!v[i] || !v[j]) continue;
        if (h[i] < h[j]) i = j;
        up(i, e[l].first);
        z++;
        for (j = 0; j < k; j++)
          if (v[a[j]] && h[a[j]] > e[l].first && f1[a[j]] >= f1[i] &&
              f1[a[j]] <= f2[i])
            v[a[j]] = 0;
      }
    }
    printf("%d\n", z);
    for (i = 0; i < k; v[a[i]] = 0, i++)
      ;
  }
  return 0;
}
