#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9;
const int MOD = 1e9 + 7;
const int N = 1e5 + 10, M = 20;
int tin[N], tout[N], pa[N][M], h[N], lv[N];
int n, n1, a[N << 1], s[N];
long long f[N][2];
vector<int> v[N], v2[N];
bool ispar(int x, int y) { return tin[x] <= tin[y] && tout[y] <= tout[x]; }
bool comp(int x, int y) { return tin[x] < tin[y]; }
int LCA(int x, int y) {
  if (lv[x] < lv[y]) swap(x, y);
  for (int v = lv[x] - lv[y], i = 0; v; i++, v >>= 1)
    if (v & 1) x = pa[x][i];
  if (x == y) return x;
  for (auto i = (int(log2(lv[x]))); i >= (0); i--)
    if (pa[x][i] != pa[y][i]) x = pa[x][i], y = pa[y][i];
  return pa[x][0];
}
void DFS(int x) {
  static int ti = 0;
  tin[x] = ++ti;
  for (auto y : v[x])
    if (y != pa[x][0]) {
      pa[y][0] = x;
      lv[y] = lv[x] + 1;
      DFS(y);
    }
  tout[x] = ti;
}
void DFS2(int x) {
  f[x][0] = inf * h[x], f[x][1] = 0;
  long long maup = inf;
  for (auto y : v2[x]) {
    DFS2(y);
    if (h[x])
      f[x][1] += min(f[y][0], f[y][1] + 1);
    else {
      f[x][0] += min(f[y][1], f[y][0]);
      f[x][1] += f[y][0];
      maup = min(maup, f[y][1] - f[y][0]);
    }
  }
  if (!h[x]) {
    f[x][0] = min(f[x][0] + 1, f[x][1]);
    f[x][1] += min(maup, 0LL);
  }
}
void prepare() {
  scanf("%d", &n);
  for (auto i = (1); i < (n); i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    v[x].push_back(y);
    v[y].push_back(x);
  }
  DFS(1);
  for (auto lay = (1); lay < (M); lay++)
    for (auto i = (1); i <= (n); i++) pa[i][lay] = pa[pa[i][lay - 1]][lay - 1];
}
int solve() {
  for (auto i = (1); i <= (n1); i++) h[a[i]] = 1;
  for (auto i = (1); i <= (n1); i++)
    if (h[pa[a[i]][0]]) return -1;
  sort(a + 1, a + n1 + 1, comp);
  for (auto i = (n1); i >= (2); i--) a[++n1] = LCA(a[i], a[i - 1]);
  sort(a + 1, a + n1 + 1, comp);
  n1 = unique(a + 1, a + n1 + 1) - a - 1;
  for (auto i = (1); i <= (n1); i++) v2[a[i]].clear();
  int top = 1;
  s[1] = a[1];
  for (auto i = (2); i <= (n1); i++) {
    while (!ispar(s[top], a[i])) top--;
    v2[s[top]].push_back(a[i]);
    s[++top] = a[i];
  }
  DFS2(a[1]);
  return min(f[a[1]][0], f[a[1]][1]);
}
int main() {
  prepare();
  int test;
  scanf("%d", &test);
  while (test--) {
    scanf("%d", &n1);
    for (auto i = (1); i <= (n1); i++) scanf("%d", a + i);
    printf("%d\n", solve());
    for (auto i = (1); i <= (n1); i++) h[a[i]] = 0;
  }
}
