#include <bits/stdc++.h>
using namespace std;
const int inf = (int)1e9;
const double eps = (double)1e-8;
const int mod = (int)1000000007;
const int maxn = (int)1e5 + 5;
int tin[maxn], tout[maxn], t[maxn], p[maxn][21], x, y, z, tim;
int n, T, k, ans;
int zn[maxn];
vector<int> a[maxn];
set<pair<int, int> > q;
void dfs(int v, int pr) {
  if (tin[v]) return;
  z = 0;
  while (pr != 0) {
    p[v][z] = pr;
    pr = p[pr][z];
    z++;
  }
  tin[v] = ++tim;
  for (int i = (0); i < (a[v].size()); i++) {
    dfs(a[v][i], v);
  }
  tout[v] = tim;
  return;
}
void dzen(int x, int y) {
  if (tin[x] <= tin[y] && tout[x] >= tin[y]) {
    z = x;
  } else if (tin[y] <= tin[x] && tout[y] >= tin[x]) {
    z = y;
  } else {
    for (int i = (20); i >= (0); i--) {
      if (tin[p[x][i]] > tin[y] || tout[p[x][i]] < tin[y]) x = p[x][i];
    }
    z = p[x][0];
  }
  if (t[z] == 0) {
    t[z]--;
    q.insert(make_pair(tin[z], z));
  } else if (t[z] > 0) {
    t[z]++;
  } else {
    t[z]--;
  }
  return;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = (1); i <= (n - 1); i++) {
    cin >> x >> y;
    a[x].push_back(y);
    a[y].push_back(x);
  }
  tim = 0;
  dfs(1, 0);
  tin[0] = 0;
  tout[0] = tim;
  cin >> T;
  while (T--) {
    cin >> k;
    ans = 0;
    for (int i = (1); i <= (k); i++) {
      cin >> zn[i];
      x = zn[i];
      t[x] = 1;
      q.insert(make_pair(tin[x], x));
    }
    for (int i = (1); i <= (k); i++) {
      if (t[p[zn[i]][0]]) ans = -1;
    }
    if (ans == -1) {
      cout << ans << "\n";
      q.clear();
      for (int i = (1); i <= (k); i++) t[zn[i]] = 0;
      continue;
    }
    while (q.size()) {
      x = (--q.end())->second;
      q.erase(--q.end());
      if (q.size()) y = (--q.end())->second;
      if (t[x] >= 1) {
        ans += t[x] - 1;
        if (q.size()) dzen(x, y);
      } else {
        if (t[x] < -1) {
          ans++;
        } else {
          if (q.size()) dzen(x, y);
        }
      }
      t[x] = 0;
    }
    cout << ans << "\n";
  }
  return 0;
}
