#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
vector<int> g[N];
int depth[N], finish[N], start[N];
int Time = 0;
int n;
int up[20][N];
void input() {
  cin >> n;
  for (int i = 1; i <= n - 1; i++) {
    int u, v;
    cin >> u >> v;
    g[u].push_back(v);
    g[v].push_back(u);
  }
}
void setup(int u, int p) {
  start[u] = ++Time;
  if (p == -1)
    up[0][u] = u;
  else
    up[0][u] = p;
  for (int i = 0; i < g[u].size(); i++) {
    int v = g[u][i];
    if (v == p) continue;
    depth[v] = depth[u] + 1;
    setup(v, u);
  }
  finish[u] = ++Time;
}
int Lca(int u, int v) {
  if (depth[u] < depth[v]) swap(u, v);
  for (int i = 19; i >= 0; i--)
    if (depth[up[i][u]] >= depth[v]) u = up[i][u];
  if (u == v) return u;
  for (int i = 19; i >= 0; i--) {
    if (up[i][u] != up[i][v]) {
      u = up[i][u];
      v = up[i][v];
    }
  }
  return up[0][u];
}
void build() {
  setup(1, -1);
  for (int lev = 1; lev <= 19; lev++) {
    for (int i = 1; i <= n; i++) {
      int jj = up[lev - 1][i];
      up[lev][i] = up[lev - 1][jj];
    }
  }
}
int imp[N];
bool comp(int x, int y) { return start[x] < start[y]; }
vector<int> bone_tree[N];
int ans;
int Find(int u) {
  int im = imp[u];
  for (int i = 0; i < bone_tree[u].size(); i++) {
    int v = bone_tree[u][i];
    int con = Find(v);
    if (imp[u] && con)
      ans += 1;
    else
      im = im + con;
  }
  if (!imp[u] && im > 1) {
    ans += 1;
    return 0;
  } else if (!imp[u])
    return im;
  else
    return 1;
}
void solve(vector<int> &has) {
  sort(has.begin(), has.end(), comp);
  int k = has.size();
  for (int i = 1; i <= k - 1; i++) {
    has.push_back(Lca(has[i], has[i - 1]));
  }
  sort(has.begin(), has.end(), comp);
  has.resize(unique(has.begin(), has.end()) - has.begin());
  stack<int> path;
  for (int i = 0; i < has.size(); i++) {
    while (path.size() && finish[path.top()] < start[has[i]]) path.pop();
    if (path.size()) bone_tree[path.top()].push_back(has[i]);
    path.push(has[i]);
  }
  ans = 0;
  Find(has[0]);
  cout << ans << endl;
  for (int i = 0; i < has.size(); i++) {
    bone_tree[has[i]].clear();
  }
}
void query() {
  int q;
  cin >> q;
  build();
  while (q--) {
    vector<int> imv;
    int k;
    cin >> k;
    for (int i = 1; i <= k; i++) {
      int x;
      cin >> x;
      imp[x] = 1;
      imv.push_back(x);
    }
    int ok = 1;
    for (int i = 0; i < imv.size(); i++) {
      int u = imv[i];
      if (u == 1) continue;
      if (imp[up[0][u]]) ok = 0;
    }
    if (!ok) {
      cout << -1 << endl;
    } else
      solve(imv);
    for (int i = 0; i < imv.size(); i++) {
      int x = imv[i];
      imp[x] = 0;
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  input();
  query();
}
