#include<bits/stdc++.h>
using namespace std;
const int N=1e5+10;
vector<int> e[N];
int n,siz[N],cnt2,top[N],dep[N],son[N],fa[N],dfn[N],a[N],q,m,cnt,b[N],f2[N],ans,s;
int head[N];
bool p[N];
struct edge {
int to,nxt;
}g[N];
void add(int u,int v) {
g[++cnt2].to=v;
g[cnt2].nxt=head[u];
head[u]=cnt2;
}
void dfs(int x,int stupied_father){
dfn[x]=++cnt;
fa[x]=stupied_father;
dep[x]=dep[stupied_father]+1;
siz[x]=1;
for(int i=0;i<e[x].size();i++){
int y=e[x][i];
if(y==stupied_father)continue;
dfs(y,x);
siz[x]+=siz[y];
if(siz[y]>siz[son[x]])son[x]=y;
}
}
void dfs2(int x,int tp){
top[x]=tp;
for(int i=0;i<e[x].size();i++){
int y=e[x][i];
if(y==fa[x])continue;
if(y==son[x])dfs2(y,tp);
else dfs2(y,y);
}
}
int lca(int u,int v){
while(1){
if(top[u]==top[v])return dep[u]<dep[v]?u:v;
if(dep[top[u]]>dep[top[v]])u=fa[top[u]];
else v=fa[top[v]];
}
}
bool cmp(int x,int y){
return dfn[x]<dfn[y];
}
bool dfs_f(int x){
if(head[x]==0){
if(p[x])return 1;
else return 0;
}
int st=0;
for(int i=head[x];i;i=g[i].nxt){
int y=g[i].to;
if(dfs_f(y))st++;
}head[x]=0;
if(st>=2&&!p[x]){
ans++;
return 0;
}else if(st>=2){
ans+=st;
return 1;
}else{
if(st==1&&p[x]){
ans++;
return 1;
}else{
if(st==0&&p[x])return 1;
else if(st==1&&!p[x])return 1;
else return 0;
}
}
}
void xushu(){
int len=0;
sort(a+1,a+m+1,cmp);
for(int i=1;i<m;++i){
p[a[i]]=1;
b[++len]=a[i];
b[++len]=lca(a[i],a[i+1]);
}
p[a[m]]=1;
b[++len]=a[m];
sort(b+1,b+len+1,cmp);
len=unique(b+1,b+len+1)-b-1;
s=a[m];
for(int i=1;i<len;++i){
int lc=lca(b[i],b[i+1]);
if(lc!=b[i+1]){
add(lc,b[i+1]);
if(dfn[s]>dfn[lc])s=lc;
}
}
dfs_f(s);
printf("%d\n",ans);
}
int main(){
scanf("%d",&n);
for(int i=1;i<n;i++){
int u,v;
scanf("%d %d",&u,&v);
e[u].push_back(v);
e[v].push_back(u);
}
dfs(1,0);
dfs2(1,1);
scanf("%d",&q);
while(q--){
scanf("%d",&m);
for(int i=1;i<=m;i++){
scanf("%d",&a[i]);
p[a[i]]=1;
}
int fla=0;
for(int i=1;i<=m;i++){
if(p[fa[a[i]]]){
fla=1;
break;
}
}
if(fla||m==0){
printf("-1\n");
for(int i=1;i<=m;i++){
p[a[i]]=0;
}
continue;
}
ans=0;
xushu();
for(int i=1;i<=m;i++){
p[a[i]]=0;
}
}
return 0;
}