#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
const int LOG = 17;
int n, m, tick;
int dep[N], a[N], par[N], lca[LOG][N];
int st[N], nd[N], id[N];
vector<int> v[N];
void dfs(int p, int x) {
  st[x] = ++tick;
  id[tick] = x;
  par[x] = p;
  dep[x] = dep[p] + 1;
  lca[0][x] = p;
  for (int i = 1; i < LOG; i++) {
    lca[i][x] = lca[i - 1][lca[i - 1][x]];
  }
  if (p) {
    v[x].erase(find(v[x].begin(), v[x].end(), p));
  }
  for (auto u : v[x]) {
    dfs(x, u);
  }
  nd[x] = tick;
}
int get(int x, int y) {
  if (dep[x] < dep[y]) swap(x, y);
  for (int i = LOG - 1; i >= 0; i--) {
    if (dep[x] - (1 << i) >= dep[y]) {
      x = lca[i][x];
    }
  }
  if (x == y) return x;
  for (int i = LOG - 1; i >= 0; i--) {
    if (lca[i][x] != lca[i][y]) {
      x = lca[i][x];
      y = lca[i][y];
    }
  }
  return lca[0][x];
}
bool h[N];
int dp[N][2];
vector<int> g[N], adds;
void add(int x, int y) {
  g[x].push_back(y);
  adds.push_back(x);
  adds.push_back(y);
}
void backup() {
  for (auto x : adds) {
    h[x] = 0;
    g[x].clear();
    dp[x][0] = dp[x][1] = -1;
  }
  adds.clear();
}
int f(int x, bool flag) {
  int &r = dp[x][flag];
  if (r != -1) return r;
  if (h[x]) {
    int r = 0;
    for (auto u : g[x]) {
      r += f(u, 1);
    }
    r += flag;
    return r;
  }
  if (!flag) {
    int res = 0, mn = 0;
    for (auto u : g[x]) {
      res += f(u, 0);
    }
    r = res + 1;
    res = 0;
    for (auto u : g[x]) {
      res += f(u, 1);
      mn = min(mn, f(u, 0) - f(u, 1));
    }
    r = min(r, res + mn);
    return r;
  }
  int res = 0;
  for (auto u : g[x]) {
    res += f(u, 0);
  }
  r = res + 1;
  res = 0;
  for (auto u : g[x]) {
    res += f(u, 1);
  }
  r = min(r, res);
  return r;
}
set<int> s;
int addT(int x) {
  int tme = st[x];
  for (int j = LOG - 1; j >= 0; j--) {
    int p = lca[j][x];
    auto it = s.lower_bound(st[p]);
    if (p and *it == tme) x = lca[j][x];
  }
  return par[x];
}
int main() {
  scanf("%d", &n);
  bool firstflag = 0;
  for (int i = 1; i < n; i++) {
    int x, y;
    scanf("%d %d", &x, &y);
    firstflag |= i == 1 and x == 26;
    v[x].push_back(y);
    v[y].push_back(x);
  }
  dfs(0, 1);
  memset(dp, -1, sizeof(dp));
  scanf("%d", &m);
  for (int i = 1; i <= m; i++) {
    int k;
    scanf("%d", &k);
    for (int i = 1; i <= k; i++) {
      scanf("%d", a + i);
    }
    if (k == 1) {
      puts("0");
      continue;
    }
    sort(a + 1, a + k + 1);
    bool flag = 0;
    for (int i = 1; i <= k; i++) {
      if (binary_search(a + 1, a + k + 1, par[a[i]])) {
        flag = 1;
        break;
      }
    }
    if (flag) {
      puts("-1");
      continue;
    }
    for (int i = 1; i <= k; i++) h[a[i]] = 1;
    sort(a + 1, a + k + 1, [&](int x, int y) { return st[x] < st[y]; });
    vector<int> nd;
    nd.push_back(1);
    for (int i = 1; i <= k; i++) nd.push_back(a[i]);
    for (int i = 1; i < k; i++) nd.push_back(get(a[i], a[i + 1]));
    nd.push_back(get(a[k], a[1]));
    sort(nd.begin(), nd.end());
    nd.resize(unique(nd.begin(), nd.end()) - nd.begin());
    s.clear();
    for (auto x : nd) {
      s.insert(st[x]);
    }
    for (auto x : nd) {
      if (x == 1) continue;
      add(addT(x), x);
    }
    printf("%d\n", f(1, 0));
    backup();
  }
  return 0;
}
