#include<bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
typedef long long LL;
typedef unsigned long long uLL;
typedef pair<int,int> pii;

const int inf=0x3f3f3f3f;
const LL Linf=1ll<<61;
const int maxn=200111;

int head[maxn],nxt[maxn<<1],to[maxn<<1],etot=1;
void addedge(int u,int v)
{
	nxt[++etot]=head[u];head[u]=etot;to[etot]=v;
	nxt[++etot]=head[v];head[v]=etot;to[etot]=u;
}

int n,m,X,q[maxn],fa[maxn],bfn[maxn];
bool mark[maxn];
void bfs()
{
	int fr=1,rr=1;q[rr++]=1;
	for(;fr<rr;fr++)
	{
		int x=q[fr];
		bfn[x]=fr;
		for(int i=head[x];i;i=nxt[i])if(to[i]!=fa[x])
		{
			fa[to[i]]=x;
			q[rr++]=to[i];
		}
	}
}
namespace centroid
{
	bool use[maxn];int sz[maxn];
	int seq[maxn],tot;
	void dfs1(int x,int f=0)
	{
		seq[++tot]=x;sz[x]=1;
		for(int i=head[x];i;i=nxt[i])if(to[i]!=f&&!use[to[i]])
		{
			dfs1(to[i],x);
			sz[x]+=sz[to[i]];
		}
	}
	int getroot(int x)
	{
		tot=0;dfs1(x);
		x=0;for(int i=1;i<=tot;i++)if(sz[seq[i]]*2>=tot&&(x==0||sz[x]>sz[seq[i]]))x=seq[i];
		return x;
	}

	int dep[maxn];
	bool cmp(int x,int y){return dep[x]<dep[y];}
	void dfs(int x,int f=0,int d=0)
	{
		dep[x]=d;
		for(int i=head[x];i;i=nxt[i])if(to[i]!=f&&!use[to[i]])dfs(to[i],x,d+1);
	}

	int fa[20][maxn], d[20][maxn], lv[maxn];
	std::vector<pii> all[maxn];
	void solve(int rt, int lvl)
	{
		rt=getroot(rt);
		lv[rt] = lvl;
		dfs(rt);
		for(int i=1; i<=tot; i++)
		{
			fa[lvl][seq[i]] = rt;
			d[lvl][seq[i]] = dep[seq[i]];
			if(mark[seq[i]]) all[rt].pb(mp(dep[seq[i]], bfn[seq[i]]));
		}
		sort(all[rt].begin(),all[rt].end());
		for(int i=1;i<all[rt].size();i++) all[rt][i].ss = min(all[rt][i].ss, all[rt][i-1].ss);
		use[rt]=1;
		for(int i=head[rt];i;i=nxt[i])if(!use[to[i]])solve(to[i], lvl+1);
	}
	int query(int x)
	{
		int ret = inf;
		for(int i = lv[x]; i>=0; i--)
		{
			int rt = fa[i][x], dep = d[i][x];
			int pos = lower_bound(all[rt].begin(), all[rt].end(), mp(X - dep, inf)) - all[rt].begin() - 1;
			if(pos >= 0) ret=min(ret, all[rt][pos].ss);
		}
		return ret;
	}
	int query_dist(int x, int y)
	{
		for(int i=lv[x]; i>=0; i--)
		{
			if(fa[i][x] == fa[i][y]) return d[i][x] + d[i][y];
		}
	}
	void decomp()
	{
		memset(use,0,sizeof(use));
		solve(1, 0);
	}
}

int f[maxn], up[maxn];
int gf(int x) { return x == f[x] ? x : f[x] = gf(f[x]); }

int query(int a, int b)
{
	if(centroid::query_dist(a,b) <= X) return true;
	int k1 = centroid::query(a), k2 = centroid::query(b);
	if(k1 <= n && k2 <= n && gf(q[k1]) == gf(q[k2])) return true;
	if(k1 <= n && centroid::query_dist(gf(q[k1]), b) <= X) return true;
	if(k2 <= n && centroid::query_dist(gf(q[k2]), a) <= X) return true;
	return false;
}

int main()
{
	scanf("%d%d%d",&n,&X,&m);
	for(int i=1, u,v; i<n; i++)
	{
		scanf("%d%d",&u,&v);
		addedge(u,v);
	}
	bfs();
	for(int i=1, x; i<=m; i++)
	{
		scanf("%d", &x);
		mark[x] = 1;
	}
	centroid::decomp();
	for(int i=1; i<=n; i++) f[i] = i;
	for(int i=1; i<=n; i++) if(mark[i])
	{
		int qq = centroid::query(i);
		if(qq<=n)
		{
			qq = q[qq];
			f[gf(i)] = gf(qq);
		}
	}
	int qv;
	scanf("%d", &qv);
	for(int i=1, a, b; i<=qv; i++)
	{
		scanf("%d%d",&a,&b);
		if(query(a,b)) puts("YES");
		else puts("NO");
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
const int maxn=4e5+10;
int n,m,k;
vector<int> v[maxn];
int fa[maxn];
int getf(int x)
{
	if(x==fa[x]) return x;
	return fa[x]=getf(fa[x]);
}
struct LCA
{
	int size[maxn],son[maxn],de[maxn],top[maxn],f[maxn][21];
	void dfs1(int x,int ff)
	{
		de[x]=de[ff]+1;
		size[x]=1;
		f[x][0]=ff;
		for(int i=1;i<=20;i++) f[x][i]=f[f[x][i-1]][i-1];
		for(int i:v[x])
		{
			if(i==ff) continue;
			dfs1(i,x);
			size[x]+=size[i];
			if(size[i]>size[son[x]]) son[x]=i;
		}
	}
	void dfs2(int x,int to)
	{
		top[x]=to;
		if(son[x]) dfs2(son[x],to);
		for(int i:v[x])
		{
			if(i==son[x]||i==f[x][0]) continue;
			dfs2(i,i);
		}
	}
	int lca(int x,int y)
	{
		while(top[x]!=top[y])
		{
			if(de[top[x]]<de[top[y]]) swap(x,y);
			x=fa[top[x]];
		}
		if(de[x]>de[y]) swap(x,y);
		return x;
	}
	int dis(int x,int y)
	{
		int p=lca(x,y);
		return de[x]+de[y]-2*de[p];
	}
}lca;
queue<int> q;
int vis[maxn],dis[maxn];
void merge(int x,int y)
{
	int fx=getf(x),fy=getf(y);
	if(fx!=fy) fa[fx]=fy;
}
int jump(int x,int to)
{
	int now=x;
	for(int i=20;i>=0;i--)
	{
		if(k&(1<<i)) now=lca.f[now][i];
	}
	if(lca.de[now]<=lca.de[to]) return to;
	return now;
}
int main()
{
	scanf("%d%d%d",&n,&k,&m);
	for(int i=1,x,y;i<n;i++)
	{
		scanf("%d%d",&x,&y);
		v[x].push_back(i+n);
		v[y].push_back(i+n);
		v[i+n].push_back(x);
		v[i+n].push_back(y);
	}
	for(int i=1;i<=2*n;i++) fa[i]=i;
	lca.dfs1(1,0);
	lca.dfs2(1,1);
	for(int i=1,x;i<=m;i++) scanf("%d",&x),q.push(x),vis[x]=1;
	while(!q.empty())
	{
		int fr=q.front();
		q.pop();
		if(dis[fr]>=k) continue;
		for(int i:v[fr])
		{
			merge(i,fr);
			if(!vis[i]) vis[i]=1,q.push(i),dis[i]=dis[fr]+1;
		}
	}
//	for(int i=1;i<=2*n;i++) printf("%d ",getf(i));printf("\n");
	int w;
	scanf("%d",&w);
	for(int i=1,x,y;i<=w;i++)
	{
		scanf("%d%d",&x,&y);
		if(lca.dis(x,y)<=2*k) printf("YES\n");
		else
		{
			int p=lca.lca(x,y);
			int fx=jump(x,p),fy=jump(y,p);
//			printf("%d %d\n",fx,fy);
			if(getf(fx)==getf(fy)) printf("YES\n");
			else printf("NO\n");
		}
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
const int maxn=4e5+10;
int n,m,k;
vector<int> v[maxn];
int fa[maxn];
int getf(int x)
{
	if(x==fa[x]) return x;
	return fa[x]=getf(fa[x]);
}
struct LCA
{
	int size[maxn],son[maxn],de[maxn],top[maxn],f[maxn][21];
	void dfs1(int x,int ff)
	{
		de[x]=de[ff]+1;
		size[x]=1;
		f[x][0]=ff;
		for(int i=1;i<=20;i++) f[x][i]=f[f[x][i-1]][i-1];
		for(int i:v[x])
		{
			if(i==ff) continue;
			dfs1(i,x);
			size[x]+=size[i];
			if(size[i]>size[son[x]]) son[x]=i;
		}
	}
	void dfs2(int x,int to)
	{
		top[x]=to;
		if(son[x]) dfs2(son[x],to);
		for(int i:v[x])
		{
			if(i==son[x]||i==f[x][0]) continue;
			dfs2(i,i);
		}
	}
	int lca(int x,int y)
	{
		while(top[x]!=top[y])
		{
			if(de[top[x]]<de[top[y]]) swap(x,y);
			x=f[top[x]][0];
		}
		if(de[x]>de[y]) swap(x,y);
		return x;
	}
	int dis(int x,int y)
	{
		int p=lca(x,y);
		return de[x]+de[y]-2*de[p];
	}
}lca;
queue<int> q;
int add=0;
int vis[maxn],dis[maxn];
void merge(int x,int y)
{
	int fx=getf(x),fy=getf(y);
	if(fx!=fy) fa[fx]=fy;
}
int jump(int x,int y,int to)
{
	int now=x;
	int p=min(k,lca.de[x]-lca.de[to]);
	add=k-p;
	if(!add)
	for(int i=20;i>=0;i--)
	{
		if(p&(1<<i)) now=lca.f[now][i];
	}
	else
	{
		now=y;
		p=lca.de[y]-lca.de[to]-add;
		for(int i=20;i>=0;i--)
		{
			if(p&(1<<i)) now=lca.f[now][i];
		}
	}
	return now;
}
int main()
{
	scanf("%d%d%d",&n,&k,&m);
	for(int i=1,x,y;i<n;i++)
	{
		scanf("%d%d",&x,&y);
		v[x].push_back(i+n);
		v[y].push_back(i+n);
		v[i+n].push_back(x);
		v[i+n].push_back(y);
	}
	for(int i=1;i<=2*n;i++) fa[i]=i;
	lca.dfs1(1,0);
	lca.dfs2(1,1);
	for(int i=1,x;i<=m;i++) scanf("%d",&x),q.push(x),vis[x]=1;
	while(!q.empty())
	{
		int fr=q.front();
		q.pop();
		if(dis[fr]>=k) continue;
		for(int i:v[fr])
		{
			merge(i,fr);
			if(!vis[i]) vis[i]=1,q.push(i),dis[i]=dis[fr]+1;
		}
	}
//	for(int i=1;i<=2*n;i++) printf("%d ",getf(i));printf("\n");
	int w;
	scanf("%d",&w);
	for(int i=1,x,y;i<=w;i++)
	{
		scanf("%d%d",&x,&y);
		if(lca.dis(x,y)<=2*k) printf("YES\n");
		else
		{
			add=0;
			int p=lca.lca(x,y);
			int fx=jump(x,y,p);
			int fy=jump(y,x,p);
//			printf("%d %d\n",fx,fy);
			if(getf(fx)==getf(fy)) printf("YES\n");
			else printf("NO\n");
		}
	}
	return 0;
}
/*
6 3 1
1 2
1 4
4 3
4 5
5 6
3
30
2 6

*/


#include<bits/stdc++.h>
using namespace std;
const int maxn=4e5+10;
int n,m,k;
vector<int> v[maxn];
int fa[maxn];
int getf(int x)
{
	if(x==fa[x]) return x;
	return fa[x]=getf(fa[x]);
}
struct LCA
{
	int f[maxn][21],de[maxn];
	void dfs1(int x,int ff)
	{
		f[x][0]=ff;
		de[x]=de[ff]+1;
		for(int i=1;i<=20;i++) f[x][i]=f[f[x][i-1]][i-1];
		for(int i:v[x])
		{
			if(i==ff) continue;
			dfs1(i,x);
		}
	}
	int lca(int x,int y)
	{
//		printf("ff=%d %d\n",x,y);
		if(de[x]<de[y]) swap(x,y);
		int h=de[x]-de[y];
		for(int i=20;i>=0;i--) if(h&(1<<i)) x=f[x][i];
		if(x==y) return x;
		for(int i=20;i>=0;i--)
		if(f[x][i]!=f[y][i]) x=f[x][i],y=f[y][i];
		return f[x][0];
	}
	int dis(int x,int y)
	{
		int p=lca(x,y);
		return de[x]+de[y]-2*de[p];
	}
}lca;
queue<int> q;
int vis[maxn],dis[maxn];
void merge(int x,int y)
{
	int fx=getf(x),fy=getf(y);
	if(fx!=fy) fa[fx]=fy;
}
int jump(int x,int to)
{
	int now=x;
	for(int i=20;i>=0;i--)
	{
		if(k&(1<<i)) now=lca.f[now][i];
	}
	if(lca.de[now]<=lca.de[to]) return to;
	return now;
}
int main()
{
	scanf("%d%d%d",&n,&k,&m);
	for(int i=1,x,y;i<n;i++)
	{
		scanf("%d%d",&x,&y);
		v[x].push_back(i+n);
		v[y].push_back(i+n);
		v[i+n].push_back(x);
		v[i+n].push_back(y);
	}
	for(int i=1;i<=2*n;i++) fa[i]=i;
	lca.dfs1(1,0);
	for(int i=1,x;i<=m;i++) scanf("%d",&x),q.push(x),vis[x]=1;
	while(!q.empty())
	{
		int fr=q.front();
		q.pop();
		if(dis[fr]>=k) continue;
		for(int i:v[fr])
		{
			merge(i,fr);
			if(!vis[i]) vis[i]=1,q.push(i),dis[i]=dis[fr]+1;
		}
	}
//	for(int i=1;i<=2*n;i++) printf("%d ",getf(i));printf("\n");
	int w;
	scanf("%d",&w);
	for(int i=1,x,y;i<=w;i++)
	{
		scanf("%d%d",&x,&y);
		if(lca.dis(x,y)<=2*k) printf("YES\n");
		else
		{
			int p=lca.lca(x,y);
			int fx=jump(x,p),fy=jump(y,p);
//			printf("%d %d\n",fx,fy);
			if(getf(fx)==getf(fy)) printf("YES\n");
			else printf("NO\n");
		}
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
const int maxn=4e5+10;
int n,m,k;
vector<int> v[maxn];
int fa[maxn];
int getf(int x)
{
	if(x==fa[x]) return x;
	return fa[x]=getf(fa[x]);
}
struct LCA
{
	int size[maxn],son[maxn],de[maxn],top[maxn],f[maxn][21];
	void dfs1(int x,int ff)
	{
		de[x]=de[ff]+1;
		size[x]=1;
		f[x][0]=ff;
		for(int i=1;i<=20;i++) f[x][i]=f[f[x][i-1]][i-1];
		for(int i:v[x])
		{
			if(i==ff) continue;
			dfs1(i,x);
			size[x]+=size[i];
			if(size[i]>size[son[x]]) son[x]=i;
		}
	}
	void dfs2(int x,int to)
	{
		top[x]=to;
		if(son[x]) dfs2(son[x],to);
		for(int i:v[x])
		{
			if(i==son[x]||i==f[x][0]) continue;
			dfs2(i,i);
		}
	}
	int lca(int x,int y)
	{
		while(top[x]!=top[y])
		{
			if(de[top[x]]<de[top[y]]) swap(x,y);
			x=f[top[x]][0];
		}
		if(de[x]>de[y]) swap(x,y);
		return x;
	}
	int dis(int x,int y)
	{
		int p=lca(x,y);
		return de[x]+de[y]-2*de[p];
	}
}lca;
queue<int> q;
int add=0;
int vis[maxn],dis[maxn];
void merge(int x,int y)
{
	int fx=getf(x),fy=getf(y);
	if(fx!=fy) fa[fx]=fy;
}
int jump(int x,int to)
{
	int now=x;
	int p=min(k,lca.de[to]-lca.de[x]);
	add=p-k;
	for(int i=20;i>=0;i--)
	{
		if(p&(1<<i)) now=lca.f[now][i];
	}
	if(lca.de[now]<=lca.de[to])
	{
		add=lca.de[to]-lca.de[now];
		return to;
	}
	return now;
}
int main()
{
	scanf("%d%d%d",&n,&k,&m);
	for(int i=1,x,y;i<n;i++)
	{
		scanf("%d%d",&x,&y);
		v[x].push_back(i+n);
		v[y].push_back(i+n);
		v[i+n].push_back(x);
		v[i+n].push_back(y);
	}
	for(int i=1;i<=2*n;i++) fa[i]=i;
	lca.dfs1(1,0);
	lca.dfs2(1,1);
	for(int i=1,x;i<=m;i++) scanf("%d",&x),q.push(x),vis[x]=1;
	while(!q.empty())
	{
		int fr=q.front();
		q.pop();
		if(dis[fr]>=k) continue;
		for(int i:v[fr])
		{
			merge(i,fr);
			if(!vis[i]) vis[i]=1,q.push(i),dis[i]=dis[fr]+1;
		}
	}
//	for(int i=1;i<=2*n;i++) printf("%d ",getf(i));printf("\n");
	int w;
	scanf("%d",&w);
	for(int i=1,x,y;i<=w;i++)
	{
		scanf("%d%d",&x,&y);
		if(lca.dis(x,y)<=2*k) printf("YES\n");
		else
		{
			add=0;
			int p=lca.lca(x,y);
			int fx=jump(x,p);
			int fy=jump(y,p);
//			printf("%d %d\n",fx,fy);
			if(getf(fx)==getf(fy)) printf("YES\n");
			else printf("NO\n");
		}
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
const int maxn=4e5+10;
int n,m,k;
vector<int> v[maxn];
int fa[maxn];
int getf(int x)
{
	if(x==fa[x]) return x;
	return fa[x]=getf(fa[x]);
}
struct LCA
{
	int f[maxn][21],de[maxn];
	void dfs1(int x,int ff)
	{
		f[x][0]=ff;
		de[x]=de[ff]+1;
		for(int i=1;i<=20;i++) f[x][i]=f[f[x][i-1]][i-1];
		for(int i:v[x])
		{
			if(i==ff) continue;
			dfs1(i,x);
		}
	}
	int lca(int x,int y)
	{
		printf("ff=%d %d\n",x,y);
		if(de[x]<de[y]) swap(x,y);
		int h=de[x]-de[y];
		for(int i=20;i>=0;i--) if(h&(1<<i)) x=f[x][i];
		if(x==y) return x;
		for(int i=20;i>=0;i--)
		if(f[x][i]!=f[y][i]) x=f[x][i],y=f[y][i];
		return f[x][0];
	}
	int dis(int x,int y)
	{
		int p=lca(x,y);
		return de[x]+de[y]-2*de[p];
	}
}lca;
queue<int> q;
int vis[maxn],dis[maxn];
void merge(int x,int y)
{
	int fx=getf(x),fy=getf(y);
	if(fx!=fy) fa[fx]=fy;
}
int jump(int x,int to)
{
	int now=x;
	for(int i=20;i>=0;i--)
	{
		if(k&(1<<i)) now=lca.f[now][i];
	}
	if(lca.de[now]<=lca.de[to]) return to;
	return now;
}
int main()
{
	scanf("%d%d%d",&n,&k,&m);
	for(int i=1,x,y;i<n;i++)
	{
		scanf("%d%d",&x,&y);
		v[x].push_back(i+n);
		v[y].push_back(i+n);
		v[i+n].push_back(x);
		v[i+n].push_back(y);
	}
	for(int i=1;i<=2*n;i++) fa[i]=i;
	lca.dfs1(1,0);
	for(int i=1,x;i<=m;i++) scanf("%d",&x),q.push(x),vis[x]=1;
	while(!q.empty())
	{
		int fr=q.front();
		q.pop();
		if(dis[fr]>=k) continue;
		for(int i:v[fr])
		{
			merge(i,fr);
			if(!vis[i]) vis[i]=1,q.push(i),dis[i]=dis[fr]+1;
		}
	}
//	for(int i=1;i<=2*n;i++) printf("%d ",getf(i));printf("\n");
	int w;
	scanf("%d",&w);
	for(int i=1,x,y;i<=w;i++)
	{
		scanf("%d%d",&x,&y);
		if(lca.dis(x,y)<=2*k) printf("YES\n");
		else
		{
			int p=lca.lca(x,y);
			int fx=jump(x,p),fy=jump(y,p);
//			printf("%d %d\n",fx,fy);
			if(getf(fx)==getf(fy)) printf("YES\n");
			else printf("NO\n");
		}
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define LL long long
#define rep(i, x, y) for(int i = (x); i <= (y); ++ i)
inline int read() {
	char ch = getchar(); int x = 0, f = 1;
	while(ch < '0' || ch > '9') {
		if(ch == '-') f = -1;
		ch = getchar();
	}
	while('0' <= ch && ch <= '9') {
		x = x * 10 + ch - '0';
		ch = getchar();
	}
	return x * f;
}
struct Edge{
	int u, v, Next;
} G[800010];
int head[400010], tot;
int ft[400010][20], h[400010];
bool vis[400010];
int d[400010], fa[400010];
inline void add(int u, int v) {
	G[++ tot] = (Edge){u, v, head[u]};
	head[u] = tot;
}
inline int Find(int x) {
	return fa[x] == x ? x : fa[x] = Find(fa[x]);
}
inline void dfs(int x, int fa) {
	h[x] = h[fa] + 1; ft[x][0] = fa;
	rep(i, 1, 19) {
		ft[x][i] = ft[ft[x][i - 1]][i - 1];
	}
	for(int i = head[x]; i != -1; i = G[i].Next) {
		if(G[i].v == fa) continue;
		dfs(G[i].v, x);
	}
}
inline void bfs(int k, int r) {
	queue<int> Q;
	rep(i, 1, r) {
		int x = read();
		Q.push(x);
		vis[x] = 1;
	}
	while(!Q.empty()) {
		int x = Q.front(); Q.pop();
		if(d[x] == k) continue;
		for(int i = head[x]; i != -1; i = G[i].Next) {
			if(Find(x) != Find(G[i].v)) {
				fa[Find(x)] = Find(G[i].v);
			}
			if(!vis[G[i].v]) {
				vis[G[i].v] = 1;
				d[G[i].v] = d[x] + 1;
				Q.push(G[i].v);
			}
		}
	}
}
inline int anc(int x, int y) {
	rep(i, 0, 19) if((1 << i) & y) {
		x = ft[x][i];
	}
	return x;
}
inline int lca(int x, int y) {
	if(h[x] < h[y]) swap(x, y);
	x = anc(x, h[x] - h[y]);
	if(x == y) return x;
	for(int i = 19; i >= 0; -- i) {
		if(ft[x][i] != ft[y][i]) {
			x = ft[x][i], y = ft[y][i];
		}
	}
	return ft[x][0];
}
inline int To(int x, int LCA, int y, int k) {
	if(h[x] - h[LCA] >= k) {
		return anc(x, k);
	}
	return anc(y, h[x] + h[y] - 2 * h[LCA] - k);
}
int main() {
	int n = read(), k = read(), r = read();
	memset(head, -1, sizeof(head));
	rep(i, 1, n - 1) {
		int u = read(), v = read();
		add(u, n + i), add(n + i, u);
		add(v, n + i), add(n + i, v);
	}
	dfs(1, 0);
	rep(i, 1, 2 * n) fa[i] = i;
	bfs(k, r);
	int q = read();
	while(q --) {
		int x = read(), y = read();
		int LCA = lca(x, y);
		if(h[x] + h[y] - 2 * h[LCA] <= 2 * k) {
			puts("YES");
		}
		else {
			int X = To(x, LCA, y, k), Y = To(y, LCA, x, k);
			if(Find(X) == Find(Y)) {
				puts("YES");
			}
			else {
				puts("NO");
			}
		}
	}
}


#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<queue>
#include<vector>
#include<cctype>
#include<set>
#include<cstdlib>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#include<ext/pb_ds/hash_policy.hpp>
#include<ext/pb_ds/trie_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef long long LL;
typedef unsigned long long ULL;
//tree<LL,null_type,less<LL>,rb_tree_tag,tree_order_statistics_node_update> tr;
const int INF=0x3f3f3f3f;
const int MAXN=4e5+5;
const int MAX_LOG=20;
inline LL getnum(){
	LL res=0,f=1;char ch=getchar();
	while(!isdigit(ch)){
		if(ch=='-')f=-1;
		ch=getchar();
	}
	while(isdigit(ch)){
		res=(res<<3)+(res<<1)+(ch^0x30);
		ch=getchar();
	}
	return res*f;
}
int n,k,r;
int S=MAX_LOG-1;
int dep[MAXN],grand[MAXN][MAX_LOG],gdis[MAXN][MAX_LOG];
vector<int> c[MAXN];
int LCA(int a,int b){
	if(dep[a]>dep[b])swap(a,b);
	for(int i=S;i>=0;i--)if(dep[a]<dep[b]&&dep[grand[b][i]]>=dep[a])b=grand[b][i];
	for(int i=S;i>=0;i--)if(grand[a][i]!=grand[b][i]) a=grand[a][i],b=grand[b][i];
	if(a!=b)a=grand[a][0];
	return a;
}
void DFS(int x){
	for(int i=1;i<=S;i++){
		grand[x][i]=grand[grand[x][i-1]][i-1];
		gdis[x][i]=gdis[x][i-1]+gdis[grand[x][i-1]][i-1];
		if(!grand[x][i]) break;
	}
	for(int i=0;i<c[x].size();i++){
		int u=c[x][i];
		if(u!=grand[x][0]){
			dep[u]=dep[x]+1;
			grand[u][0]=x,gdis[u][0]=1;
			DFS(u);
		}
	}
}
int f[MAXN];
inline int find(int x){
	return f[x]==x?x:f[x]=find(f[x]);
}
int rest[MAXN];
int dis[MAXN];
inline void BFS(){
	memset(dis,-1,sizeof(dis));
	queue<int> Q;
	for(int i=1;i<=r;i++){
		Q.push(rest[i]);
		dis[rest[i]]=0;
	}
	while(!Q.empty()){
		int now=Q.front();Q.pop();
		if(dis[now]==k)continue;
		for(int i=0;i<c[now].size();i++){
			int to=c[now][i];
			if(dis[to]==-1){
				dis[to]=dis[now]+1;
				Q.push(to);
			}
			f[find(to)]=find(now);
		}
	}
}
int climb(int x,int y){
	for(int i=MAX_LOG-1;i>=0;i--){
		if(y&(1<<i))x=grand[x][i];
	}
	return x;
}

int main(){
	//freopen("in.txt","r",stdin);
	n=getnum();k=getnum();r=getnum();
	for(int i=1;i<n;i++){
		int x=getnum(),y=getnum();
		c[x].push_back(n+i);
		c[n+i].push_back(x);
		c[y].push_back(n+i);
		c[n+i].push_back(y);
	}
	n+=n-1;
	for(int i=1;i<=r;i++){
		rest[i]=getnum();
	}
	dep[0]=-1;
	DFS(1);
	for(int i=1;i<=n;i++){
		f[i]=i;
	}
	BFS();
	int q=getnum();
	while(q--){
		int x=getnum(),y=getnum();
		int z=LCA(x,y);
		if(dep[x]+dep[y]-2*dep[z]<=2*k)puts("YES");
		else {
			if(dep[x]-dep[z]>=k)x=climb(x,k);
			else x=climb(y,dep[x]+dep[y]-2*dep[z]-k);
			if(dep[y]-dep[z]>=k)y=climb(y,k);
			else y=climb(x,dep[x]+dep[y]-2*dep[z]-k);
			if(find(x)==find(y))puts("YES");
			else puts("NO");
		}
	}
	return(0);
}


#include<bits/stdc++.h>
using namespace std;
const int N=4e5+10;
typedef vector<int> vi;
#define pb push_back

int gi() {
	int x=0,o=1;char ch=getchar();
	while((ch<'0'||ch>'9')&&ch!='-') ch=getchar();
	if(ch=='-') o=-1,ch=getchar();
	while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar();
	return x*o;
}

int n,k,r,dis[N],fa[N],anc[N][20],dep[N],dsu[N];
vi E[N];

int getf(int x) {
	return x==dsu[x]?x:dsu[x]=getf(dsu[x]);
}

void dfs(int u,int ff) {
	anc[u][0]=fa[u]=ff;dep[u]=dep[ff]+1;
	for(int i=1;i<=18;i++) anc[u][i]=anc[anc[u][i-1]][i-1];
	for(auto v:E[u]) if(v!=ff) dfs(v,u);
}

int lca(int u,int v) {
	if(dep[u]<dep[v]) swap(u,v);
	int c=dep[u]-dep[v];
	for(int i=18;~i;i--) if(c>>i&1) u=anc[u][i];
	if(u==v) return u;
	for(int i=18;~i;i--) if(anc[u][i]!=anc[v][i]) u=anc[u][i],v=anc[v][i];
	return fa[u];
}

int jump(int u,int k) {
	for(int i=18;~i;i--) if(k>>i&1) u=anc[u][i];
	return u;
}

int main() {
	cin>>n>>k>>r;
	for(int i=1,u,v;i<n;i++) u=gi(),v=gi(),E[u].pb(i+n),E[i+n].pb(u),E[v].pb(i+n),E[i+n].pb(v);
	n=n*2-1;memset(dis,0x3f,sizeof(dis));
	for(int i=1;i<=n;i++) dsu[i]=i;
	queue<int> q;
	for(int i=1,u;i<=r;i++) u=gi(),dis[u]=0,q.push(u);
	while(!q.empty()) {
		int u=q.front();q.pop();if(dis[u]==k) continue;
		for(auto v:E[u]) {
			if(dis[v]>dis[u]+1) dis[v]=dis[u]+1,q.push(v);
			dsu[getf(u)]=getf(v);
		}
	}
	dfs(1,0);int T=gi();
	while(T--) {
		int u=gi(),v=gi(),p=lca(u,v),dis=dep[u]+dep[v]-2*dep[p];
		if(dis<=2*k) puts("YES");
		else {
			if(dep[u]-dep[p]>=k) u=jump(u,k);
			else u=jump(v,dis-k);
			p=lca(u,v);dis=dep[u]+dep[v]-2*dep[p];
			if(dep[v]-dep[p]>=k) v=jump(v,k);
			else v=jump(u,dis-k);
			puts(getf(u)==getf(v)?"YES":"NO");
		}
	}
	return 0;
}


//#include <bits/stdc++.h>
#include <cstdio>
#include <iostream>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#include <algorithm>
#include <cstring>
#include <string>
using namespace std;
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define de(x) cout<<#x<<" = "<<x<<"\n"
#define dd(x) cout<<#x<<" = "<<x<<" "
#define mes(p) memset(p,0,sizeof(p))
#define per(i,a,b) for(int i=(b)-1;i>=a;i--)
#define all(x) x.begin(),x.end()
#define rson mid+1,r,rt<<1|1
#define sz(x) (int)x.size()
#define mp make_pair
#define lson l,mid,rt<<1
#define pb push_back
#define ls (rt<<1)
#define rs (ls|1)
#define se second
#define fi first
typedef pair <int ,int > pi;
typedef double db;
typedef vector <int > vi;
typedef vector <pair <int , int > >  vii;
typedef unsigned long long ull;
typedef long long ll;
const ll mod = 1e9+7;
const ll LINF = 0x3f3f3f3f3f3f3f3f;
const int INF = 0x3f3f3f3f;
const int maxn=4e5+ 5;
int dep[maxn], f[maxn][23], dis[maxn], fa[maxn];
int n, k ,r;
vi e[maxn];
void dfs(int x,int p,int d){ // dfs(rt,rt,0)
	dep[x] = d;
	f[x][0] = p;
	rep(i,1,22)
		f[x][i] = f[f[x][i-1]][i-1];
	for(auto u:e[x])
		if(u!=p)
			dfs(u,x,d+1);
}
int lca(int u,int v){
	if(dep[u] < dep[v]) swap(u,v);
	for(int i=22,d=dep[u]-dep[v];i>=0;i--)
		if(d>>i&1) u=f[u][i];
	if(u==v) return v;
	for(int i=22;i>=0;i--)
	if(f[u][i]!=f[v][i])
		u=f[u][i], v=f[v][i];
	return f[u][0];
}
int find(int x){
	if(fa[x]==x) return x;
	return fa[x] = find(fa[x]);
}
int jump(int x,int k){
	for(int i=22;i>=0;i--)
		if(k>>i&1) x = f[x][i];
	return x;
}
int main(){
	ios_base::sync_with_stdio(0);
    cin.tie(0);
	cin >> n >> k >> r;
	rep(i,1,n) {
		int x, y;
		cin >> x>>y;
		e[x].pb(i+n);  e[i+n].pb(x);
		e[y].pb(i+n);  e[i+n].pb(y);
	}
	n += n -1;
	dfs(1,1,0);
	vi q;
	rep(i,1,n+1) fa[i] = i;
	memset(dis, -1, sizeof(dis));
	rep(i,0,r){
		int x;
		cin >> x;
		dis[x] = 0;
		q.pb(x);
	}
	rep(i,0,sz(q)){
		int x = q[i];
		if(dis[x]==k) continue;
		for(auto u:e[x]){
			if(dis[u]==-1){
				dis[u] = dis[x] + 1;
				q.pb(u);
			}
			fa[find(u)] = find(x);
		}
	}
	int m;
	cin >> m;
	while(m--){
		int x, y;
		cin >> x>> y;
		int l = lca(x, y), len = dep[x] + dep[y] - 2*dep[l];
		if(len <= 2*k) cout<< "YES\n";
		else {
			int xx = x;
			if(dep[x]-dep[l]>=k) x = jump(x, k);
			else x = jump(y, len - k);
			if(dep[y]-dep[l]>=k) y= jump(y,k);
			else y = jump(xx, len - k);
			if(find(x)==find(y)) cout << "YES\n";
			else cout << "NO\n";
		}
	}
	return 0;
}


/*
Problem : CF 1307F
Algorithm : dsu + LCA
Status :
*/
#include<bits/stdc++.h>
#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#define DEBUG printf("Passing Line %d in Function [%s].\n",__LINE__,__FUNCTION__);
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;

const int INF = 0x3f3f3f3f;
const int MAXN = 4e5 + 5;
const int LOG = 20;

int n,k,r,Q,len;
int head[MAXN],dep[MAXN],f[MAXN][LOG],dis[MAXN],stop[MAXN];
queue<int> q;

struct Edge{
    int to,next;
} e[MAXN << 1];

namespace UnionSet{
    int fa[MAXN];

    void Init(){
        for(int i = 1;i <= n;i++)
            fa[i] = i;
    }

    int Find(int x){
        if(fa[x] == x)
            return x;
        else
            return fa[x] = Find(fa[x]);
    }

    void Union(int x,int y){
        int fx = Find(x);
        int fy = Find(y);
        if(fx != fy)
            fa[fx] = fy;
    }
}

void add(int u,int v){
    e[++len].to = v;
    e[len].next = head[u];
    head[u] = len;
}

void dfs(int u,int fa){
    dep[u] = dep[fa] + 1;
    f[u][0] = fa;
    for(int i = 1;i < LOG;i++)
        f[u][i] = f[f[u][i - 1]][i - 1];
    for(int i = head[u];i != -1;i = e[i].next){
        int v = e[i].to;
        if(v == fa)
            continue;
        dfs(v,u);
    }
}

void bfs(){
    memset(dis,-1,sizeof(dis));
    for(int i = 1;i <= r;i++){
        q.push(stop[i]);
        dis[stop[i]] = 0;
    }
    UnionSet::Init();
    while(!q.empty()){
        int u = q.front();
        q.pop();
        if(dis[u] == k)
            break;
        for(int i = head[u];i != -1;i = e[i].next){
            int v = e[i].to;
            UnionSet::Union(u,v);
            if(dis[v] != -1)
                continue;
            q.push(v);
            dis[v] = dis[u] + 1;
        }
    }
}

int LCA(int u,int v){
    if(dep[v] > dep[u])
        swap(u,v);
    for(int i = LOG - 1;i >= 0;i--){
        if(dep[f[u][i]] >= dep[v])
            u = f[u][i];
    }
    if(u == v)
        return u;
    for(int i = LOG - 1;i >= 0;i--){
        if(f[u][i] != f[v][i]){
            u = f[u][i];
            v = f[v][i];
        }
    }
    return f[u][0];
}

int GetDis(int u,int v){
    return dep[u] + dep[v] - 2 * dep[LCA(u,v)];
}

int Move(int u,int d){
    for(int i = LOG - 1;i >= 0;i--){
        if(d & (1 << i)){
            d -= (1 << i);
            u = f[u][i];
        }
    }
    return u;
}

int main(){
    freopen("data.in","r",stdin);
    //freopen(".out","w",stdout);
    memset(head,-1,sizeof(head));
    scanf("%d%d%d",&n,&k,&r);
    int N = n;
    for(int i = 1;i < N;i++){
        int u,v;
        scanf("%d%d",&u,&v);
        n++;
        add(u,n);
        add(n,u);
        add(v,n);
        add(n,v);
    }
    for(int i = 1;i <= r;i++)
        scanf("%d",&stop[i]);
    dfs(1,0);
    bfs();
    scanf("%d",&Q);
    while(Q--){
        int u,v;
        scanf("%d%d",&u,&v);
        int lca = LCA(u,v);
        int d = dep[u] + dep[v] - 2 * dep[lca];
        if(d <= 2 * k)
            puts("YES");
        else{
            int fu = (dep[u] - dep[lca] >= k ? UnionSet::Find(Move(u,k)) : UnionSet::Find(Move(v,d - k)));
            int fv = (dep[v] - dep[lca] >= k ? UnionSet::Find(Move(v,k)) : UnionSet::Find(Move(u,d - k)));
            if(fu == fv)
                puts("YES");
            else
                puts("NO");
        }
    }
    return 0;
}


/*
Problem : CF 1307F
Algorithm : dsu + LCA
Status :
*/
#include<bits/stdc++.h>
#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#define DEBUG printf("Passing Line %d in Function [%s].\n",__LINE__,__FUNCTION__);
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;

const int INF = 0x3f3f3f3f;
const int MAXN = 4e5 + 5;
const int LOG = 20;

int n,k,r,Q,len;
int head[MAXN],dep[MAXN],f[MAXN][LOG],dis[MAXN],stop[MAXN];
queue<int> q;

struct Edge{
    int to,next;
} e[MAXN << 1];

namespace UnionSet{
    int fa[MAXN];

    void Init(){
        for(int i = 1;i <= n;i++)
            fa[i] = i;
    }

    int Find(int x){
        if(fa[x] == x)
            return x;
        else
            return fa[x] = Find(fa[x]);
    }

    void Union(int x,int y){
        int fx = Find(x);
        int fy = Find(y);
        if(fx != fy)
            fa[fx] = fy;
    }
}

void add(int u,int v){
    e[++len].to = v;
    e[len].next = head[u];
    head[u] = len;
}

void dfs(int u,int fa){
    dep[u] = dep[fa] + 1;
    f[u][0] = fa;
    for(int i = 1;i < LOG;i++)
        f[u][i] = f[f[u][i - 1]][i - 1];
    for(int i = head[u];i != -1;i = e[i].next){
        int v = e[i].to;
        if(v == fa)
            continue;
        dfs(v,u);
    }
}

void bfs(){
    memset(dis,-1,sizeof(dis));
    for(int i = 1;i <= r;i++){
        q.push(stop[i]);
        dis[stop[i]] = 0;
    }
    UnionSet::Init();
    while(!q.empty()){
        int u = q.front();
        q.pop();
        if(dis[u] == k)
            break;
        for(int i = head[u];i != -1;i = e[i].next){
            int v = e[i].to;
            UnionSet::Union(u,v);
            if(dis[v] != -1)
                continue;
            q.push(v);
            dis[v] = dis[u] + 1;
        }
    }
}

int LCA(int u,int v){
    if(dep[v] > dep[u])
        swap(u,v);
    for(int i = LOG - 1;i >= 0;i--){
        if(dep[f[u][i]] >= dep[v])
            u = f[u][i];
    }
    if(u == v)
        return u;
    for(int i = LOG - 1;i >= 0;i--){
        if(f[u][i] != f[v][i]){
            u = f[u][i];
            v = f[v][i];
        }
    }
    return f[u][0];
}

int GetDis(int u,int v){
    return dep[u] + dep[v] - 2 * dep[LCA(u,v)];
}

int Move(int u,int d){
    for(int i = LOG - 1;i >= 0;i--){
        if(d & (1 << i)){
            d -= (1 << i);
            u = f[u][i];
        }
    }
    return u;
}

int main(){
    //freopen("data.in","r",stdin);
    //freopen(".out","w",stdout);
    memset(head,-1,sizeof(head));
    scanf("%d%d%d",&n,&k,&r);
    int N = n;
    for(int i = 1;i < N;i++){
        int u,v;
        scanf("%d%d",&u,&v);
        n++;
        add(u,n);
        add(n,u);
        add(v,n);
        add(n,v);
    }
    for(int i = 1;i <= r;i++)
        scanf("%d",&stop[i]);
    dfs(1,0);
    bfs();
    scanf("%d",&Q);
    while(Q--){
        int u,v;
        scanf("%d%d",&u,&v);
        int lca = LCA(u,v);
        int d = dep[u] + dep[v] - 2 * dep[lca];
        if(d <= 2 * k)
            puts("YES");
        else{
            int fu = (dep[u] - dep[lca] >= k ? UnionSet::Find(Move(u,k)) : UnionSet::Find(Move(v,d - k)));
            int fv = (dep[v] - dep[lca] >= k ? UnionSet::Find(Move(v,k)) : UnionSet::Find(Move(u,d - k)));
            if(fu == fv)
                puts("YES");
            else
                puts("NO");
        }
    }
    return 0;
}


#include <cstdio>
#include <vector>
#include <cassert>
#include <queue>
#include <algorithm>

const int INF=1e9+7;

std::vector<int> edges[400005];

int anc[19][400005];
int depth[400005];

void dfs(int node){
  for(int child:edges[node]){
    edges[child].erase(std::find(edges[child].begin(),edges[child].end(),node));
    anc[0][child]=node;
    for(int k=1;k<19;k++){
      anc[k][child]=anc[k-1][anc[k-1][child]];
    }
    depth[child]=depth[node]+1;
    dfs(child);
  }
}

int la(int node,int len){
  for(int k=19-1;k>=0;k--){
    if(len&(1<<k)){
      node=anc[k][node];
    }
  }
  return node;
}

int lca(int a,int b){
  if(depth[a]<depth[b]) std::swap(a,b);
  a=la(a,depth[a]-depth[b]);
  if(a==b) return a;
  for(int k=19-1;k>=0;k--){
    if(anc[k][a]!=anc[k][b]){
      a=anc[k][a];
      b=anc[k][b];
    }
  }
  return anc[0][a];
}

//move x steps from a to b
//assumes x<=dist(a,b)
int walk(int a,int b,int x){
  int c=lca(a,b);
  if(x<=depth[a]-depth[c]){
    return la(a,x);
  }
  int excess=x-(depth[a]-depth[c]);
  assert(excess<=(depth[b]-depth[c]));
  return la(b,depth[b]-depth[c]-excess);
}

int uf[400005];
int dist[400005];//dist[x]=0 iff x is rest stop

int find(int a){
  return fa[a] = fa[a] == a ? a : find(fa[a]);
}

bool query(int K){
  int A,B;
  scanf("%d %d",&A,&B);
  A--,B--;
  int C=lca(A,B);
  if(depth[A]+depth[B]-2*depth[C]<=2*K){
    return true;
  }else{
    int A2=walk(A,B,K+1),B2=walk(B,A,K+1);
    return find(walk(A,B,K))==find(walk(B,A,K));
  }
}

int main(){
  int N,K,R;
  scanf("%d %d %d",&N,&K,&R);
  int oldN=N;
  for(int i=0;i<oldN-1;i++){
    int X,Y;
    scanf("%d %d",&X,&Y);
    X--,Y--;
    edges[X].push_back(N);
    edges[N].push_back(X);
    edges[Y].push_back(N);
    edges[N].push_back(Y);
    N++;
  }
  for(int i=0;i<N;i++){
    uf[i]=i;
  }
  std::fill(dist,dist+N,INF);
  std::queue<int> frontier;
  for(int i=0;i<R;i++){
    int X;
    scanf("%d",&X);
    X--;
    dist[X]=0;
    frontier.push(X);
  }
  while(!frontier.empty()){
    int x=frontier.front();
    if(dist[x]>K-1) break;
    frontier.pop();
    for(int y:edges[x]){
      uf[find(y)]=find(x);
      if(dist[y]==INF){
	dist[y]=dist[x]+1;
	frontier.push(y);
      }
    }
  }
  dfs(0);
  int V;
  scanf("%d",&V);
  while(V--){
    if(query(K)){
      printf("YES\n");
    }else{
      printf("NO\n");
    }
  }
}


#include <cstdio>
#include <vector>
#include <cassert>
#include <queue>
#include <algorithm>

const int INF=1e9+7;

std::vector<int> edges[400005];

int anc[19][400005];
int depth[400005];

void dfs(int node){
  for(int child:edges[node]){
    edges[child].erase(std::find(edges[child].begin(),edges[child].end(),node));
    anc[0][child]=node;
    for(int k=1;k<19;k++){
      anc[k][child]=anc[k-1][anc[k-1][child]];
    }
    depth[child]=depth[node]+1;
    dfs(child);
  }
}

int la(int node,int len){
  for(int k=19-1;k>=0;k--){
    if(len&(1<<k)){
      node=anc[k][node];
    }
  }
  return node;
}

int lca(int a,int b){
  if(depth[a]<depth[b]) std::swap(a,b);
  a=la(a,depth[a]-depth[b]);
  if(a==b) return a;
  for(int k=19-1;k>=0;k--){
    if(anc[k][a]!=anc[k][b]){
      a=anc[k][a];
      b=anc[k][b];
    }
  }
  return anc[0][a];
}

//move x steps from a to b
//assumes x<=dist(a,b)
int walk(int a,int b,int x){
  int c=lca(a,b);
  if(x<=depth[a]-depth[c]){
    return la(a,x);
  }
  int excess=x-(depth[a]-depth[c]);
  assert(excess<=(depth[b]-depth[c]));
  return la(b,depth[b]-depth[c]-excess);
}

int uf[400005];
int dist[400005];//dist[x]=0 iff x is rest stop

int find(int a){
    return uf[a] = uf[a] == a ? find(uf[a]);
}

bool query(int K){
  int A,B;
  scanf("%d %d",&A,&B);
  A--,B--;
  int C=lca(A,B);
  if(depth[A]+depth[B]-2*depth[C]<=2*K){
    return true;
  }else{
    int A2=walk(A,B,K+1),B2=walk(B,A,K+1);
    return find(walk(A,B,K))==find(walk(B,A,K));
  }
}

int main(){
  int N,K,R;
  scanf("%d %d %d",&N,&K,&R);
  int oldN=N;
  for(int i=0;i<oldN-1;i++){
    int X,Y;
    scanf("%d %d",&X,&Y);
    X--,Y--;
    edges[X].push_back(N);
    edges[N].push_back(X);
    edges[Y].push_back(N);
    edges[N].push_back(Y);
    N++;
  }
  for(int i=0;i<N;i++){
    uf[i]=i;
  }
  std::fill(dist,dist+N,INF);
  std::queue<int> frontier;
  for(int i=0;i<R;i++){
    int X;
    scanf("%d",&X);
    X--;
    dist[X]=0;
    frontier.push(X);
  }
  while(!frontier.empty()){
    int x=frontier.front();
    if(dist[x]>K-1) break;
    frontier.pop();
    for(int y:edges[x]){
      uf[find(y)]=find(x);
      if(dist[y]==INF){
	dist[y]=dist[x]+1;
	frontier.push(y);
      }
    }
  }
  dfs(0);
  int V;
  scanf("%d",&V);
  while(V--){
    if(query(K)){
      printf("YES\n");
    }else{
      printf("NO\n");
    }
  }
}


#include <cstdio>
#include <vector>
#include <cassert>
#include <queue>
#include <algorithm>

const int INF=1e9+7;

std::vector<int> edges[400005];

int anc[19][400005];
int depth[400005];

void dfs(int node){
  for(int child:edges[node]){
    edges[child].erase(std::find(edges[child].begin(),edges[child].end(),node));
    anc[0][child]=node;
    for(int k=1;k<19;k++){
      anc[k][child]=anc[k-1][anc[k-1][child]];
    }
    depth[child]=depth[node]+1;
    dfs(child);
  }
}

int la(int node,int len){
  for(int k=19-1;k>=0;k--){
    if(len&(1<<k)){
      node=anc[k][node];
    }
  }
  return node;
}

int lca(int a,int b){
  if(depth[a]<depth[b]) std::swap(a,b);
  a=la(a,depth[a]-depth[b]);
  if(a==b) return a;
  for(int k=19-1;k>=0;k--){
    if(anc[k][a]!=anc[k][b]){
      a=anc[k][a];
      b=anc[k][b];
    }
  }
  return anc[0][a];
}

//move x steps from a to b
//assumes x<=dist(a,b)
int walk(int a,int b,int x){
  int c=lca(a,b);
  if(x<=depth[a]-depth[c]){
    return la(a,x);
  }
  int excess=x-(depth[a]-depth[c]);
  assert(excess<=(depth[b]-depth[c]));
  return la(b,depth[b]-depth[c]-excess);
}

int uf[400005];
int dist[400005];//dist[x]=0 iff x is rest stop

int find(int a){
  return uf[a] = uf[a] == a ? a : find(uf[a]);
}

bool query(int K){
  int A,B;
  scanf("%d %d",&A,&B);
  A--,B--;
  int C=lca(A,B);
  if(depth[A]+depth[B]-2*depth[C]<=2*K){
    return true;
  }else{
    int A2=walk(A,B,K+1),B2=walk(B,A,K+1);
    return find(walk(A,B,K))==find(walk(B,A,K));
  }
}

int main(){
  int N,K,R;
  scanf("%d %d %d",&N,&K,&R);
  int oldN=N;
  for(int i=0;i<oldN-1;i++){
    int X,Y;
    scanf("%d %d",&X,&Y);
    X--,Y--;
    edges[X].push_back(N);
    edges[N].push_back(X);
    edges[Y].push_back(N);
    edges[N].push_back(Y);
    N++;
  }
  for(int i=0;i<N;i++){
    uf[i]=i;
  }
  std::fill(dist,dist+N,INF);
  std::queue<int> frontier;
  for(int i=0;i<R;i++){
    int X;
    scanf("%d",&X);
    X--;
    dist[X]=0;
    frontier.push(X);
  }
  while(!frontier.empty()){
    int x=frontier.front();
    if(dist[x]>K-1) break;
    frontier.pop();
    for(int y:edges[x]){
      uf[find(y)]=find(x);
      if(dist[y]==INF){
	dist[y]=dist[x]+1;
	frontier.push(y);
      }
    }
  }
  dfs(0);
  int V;
  scanf("%d",&V);
  while(V--){
    if(query(K)){
      printf("YES\n");
    }else{
      printf("NO\n");
    }
  }
}


#define DEBUG 0

#include <bits/stdc++.h>
using namespace std;

#if DEBUG
// basic debugging macros
int __i__,__j__;
#define printLine(l) for(__i__=0;__i__<l;__i__++){cout<<"-";}cout<<endl
#define printLine2(l,c) for(__i__=0;__i__<l;__i__++){cout<<c;}cout<<endl
#define printVar(n) cout<<#n<<": "<<n<<endl
#define printArr(a,l) cout<<#a<<": ";for(__i__=0;__i__<l;__i__++){cout<<a[__i__]<<" ";}cout<<endl
#define print2dArr(a,r,c) cout<<#a<<":\n";for(__i__=0;__i__<r;__i__++){for(__j__=0;__j__<c;__j__++){cout<<a[__i__][__j__]<<" ";}cout<<endl;}
#define print2dArr2(a,r,c,l) cout<<#a<<":\n";for(__i__=0;__i__<r;__i__++){for(__j__=0;__j__<c;__j__++){cout<<setw(l)<<setfill(' ')<<a[__i__][__j__]<<" ";}cout<<endl;}

// advanced debugging class
// debug 1,2,'A',"test";
class _Debug {
    public:
        template<typename T>
        _Debug& operator,(T val) {
            cout << val << endl;
            return *this;
        }
};
#define debug _Debug(),
#else
#define printLine(l)
#define printLine2(l,c)
#define printVar(n)
#define printArr(a,l)
#define print2dArr(a,r,c)
#define print2dArr2(a,r,c,l)
#define debug
#endif

// define
#define MAX_VAL 999999999
#define MAX_VAL_2 999999999999999999LL
#define EPS 1e-6
#define mp make_pair
#define pb push_back

// typedef
typedef unsigned int UI;
typedef long long int LLI;
typedef unsigned long long int ULLI;
typedef unsigned short int US;
typedef pair<int,int> pii;
typedef pair<LLI,LLI> plli;
typedef vector<int> vi;
typedef vector<LLI> vlli;
typedef vector<pii> vpii;
typedef vector<plli> vplli;

// ---------- END OF TEMPLATE ----------

vi adjList[200000];
int dist[200000],stop[200000];
queue<int> Q;
int ds[200000];
int find(int n) {
    if (ds[n] != n) ds[n] = find(ds[n]);
    return ds[n];
}
int parent[200000][18],depth[200000];
int doDFS(int u,int p,int d) {
    int i;
    parent[u][0] = p,depth[u] = d;
    for (i = 0; i < adjList[u].size(); i++) {
        int v = adjList[u][i];
        if (v != p) doDFS(v,u,d+1);
    }
    return 0;
}
int lca(int u,int v,int logn) {
    int i;
    if (depth[u] < depth[v]) swap(u,v);
    for (i = logn-1; i >= 0; i--) {
        if ((parent[u][i] != -1) && (depth[parent[u][i]] >= depth[v])) u = parent[u][i];
    }
    if (u == v) return u;
    for (i = logn-1; i >= 0; i--) {
        if (parent[u][i] != parent[v][i]) u = parent[u][i],v = parent[v][i];
    }
    return parent[u][0];
}
int getNode(int u,int v,int d,int l,int logn) {
    if (d > depth[u]-depth[l]) return getNode(v,u,depth[u]+depth[v]-2*depth[l]-d,l,logn);
    int i;
    for (i = logn-1; i >= 0; i--) {
        if (d & (1 << i)) u = parent[u][i];
    }
    return u;
}
int main() {
    int i;
    int n,k,r,q;
    int u,v;
    scanf("%d %d %d",&n,&k,&r);
    for (i = 0; i < n-1; i++) {
        scanf("%d %d",&u,&v);
        u--,v--;
        adjList[u].pb(v);
        adjList[v].pb(u);
    }
    fill(dist,dist+n,-1);
    for (i = 0; i < r; i++) scanf("%d",&u),u--,dist[u] = 0,stop[u] = i,Q.push(u);

    int j;
    doDFS(0,-1,0);
    for (i = 1; (1 << i) < n; i++) {
        for (j = 0; j < n; j++) {
            if (parent[j][i-1] != -1) parent[j][i] = parent[parent[j][i-1]][i-1];
            else parent[j][i] = -1;
        }
    }
    int logn = i;

    for (i = 0; i < n; i++) ds[i] = i;
    while (!Q.empty()) {
        int u = Q.front();
        Q.pop();

        for (i = 0; i < adjList[u].size(); i++) {
            int v = adjList[u][i];
            if (dist[v] == -1) {
                dist[v] = dist[u]+1;
                stop[v] = stop[u];
                Q.push(v);
            }
            else if ((dist[u]+dist[v]+1 <= k) && (stop[u] != stop[v])) {
                int pa = find(stop[u]),pb = find(stop[v]);
                if (pa != pb) ds[pa] = pb;
            }
        }
    }

    scanf("%d",&q);
    for (i = 0; i < q; i++) {
        scanf("%d %d",&u,&v);
        u--,v--;
        int l = lca(u,v,logn);
        if (depth[u]+depth[v]-2*depth[l] <= k) printf("YES\n");
        else {
            int a = getNode(u,v,(k+1)/2,l,logn);
            int b = getNode(v,u,(k+1)/2,l,logn);
            if ((dist[a] <= k/2) && (dist[b] <= k/2) && (find(stop[a]) == find(stop[b]))) printf("YES\n");
            else printf("NO\n");
        }
    }

    return 0;
}


#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
#include<queue>
using namespace std;
struct Edge{
	int v,nxt;
}e[800010];int tot;
int first[400010];
void build(int u,int v)
{
	e[++tot]=(Edge){v,first[u]};
	first[u]=tot;
	return ;
}
int fa[400010][21],dep[400010];
void dfs(int u,int lst)
{
	dep[u]=dep[lst]+1;
	fa[u][0]=lst;
	for(int i=1;i<=20;i++)
		fa[u][i]=fa[fa[u][i-1]][i-1];
	for(int i=first[u];i;i=e[i].nxt)
		if(e[i].v!=lst)dfs(e[i].v,u);
	return ;
}
int getlca(int x,int y)
{
	if(dep[x]<dep[y])swap(x,y);
	int need=dep[x]-dep[y],now=0;
	while(need){
		if(need&1)x=fa[x][now];
		now++;need>>=1;
	}
	if(x==y)return x;
	for(int i=20;i>=0;i--)
		if(fa[x][i]!=fa[y][i])
			x=fa[x][i],y=fa[y][i];
	return fa[x][0];
}
int jump(int u,int x)
{
	int now=0;
	while(x)
	{
		if(x&1)u=fa[u][now];
		now++;x>>=1;
	}
	return u;
}
int walk(int u,int v,int x)
{
	int lca=getlca(u,v);
	if(dep[u]-dep[lca]>=x)return jump(u,x);
	return jump(v,dep[u]+dep[v]-dep[lca]*2-x);
}
int f[400010];
int find(int x)
{
	return f[x]==x?x:f[x]=find(f[x]);
}
bool merge(int x,int y)
{
	int f1=find(x),f2=find(y);
	if(f1==f2)return false;
	f[f2]=f1;
	return true;
}
int n,k,r;
int a[200010],dis[400010];
void bfs()
{
	memset(dis,0x3f,sizeof(dis));
	queue<int>q;
	for(int i=1;i<=r;i++)
		q.push(a[i]),dis[a[i]]=0;
	while(!q.empty())
	{
		int u=q.front();
		q.pop();
		if(dis[u]>=k)continue;
		for(int i=first[u];i;i=e[i].nxt)
		{
			int v=e[i].v;
			merge(u,v);
			if(dis[v]>n){
				dis[v]=dis[u]+1;
				q.push(v);
			}
		}
	}
	return ;
}
bool solve()
{
	int x,y;scanf("%d %d",&x,&y);
	int lca=getlca(x,y);
	if(dep[x]+dep[y]-2*dep[lca]<=2*k)return true;
	if(find(walk(x,y,k))==find(walk(y,x,k)))
		return true;
	return false;
}
int main()
{
	scanf("%d %d %d",&n,&k,&r);
	int N=n;
	for(int i=1;i<n;i++)
	{
		int u,v;
		scanf("%d %d",&u,&v);
		N++;
		build(u,N);build(N,u);
		build(v,N);build(N,v);
	}
	for(int i=1;i<=r;i++)
		scanf("%d",&a[i]);
	for(int i=1;i<=N;i++)f[i]=i;
	dfs(1,0);
	bfs();
	int q;scanf("%d",&q);
	while(q--){
		if(solve())printf("YES\n");
		else printf("NO\n");
	}
	return 0;
}


#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
using namespace std;
struct Edge{
	int v,nxt;
}e[800010];int tot;
int first[400010];
void build(int u,int v)
{
	e[++tot]=(Edge){v,first[u]};
	first[u]=tot;
	return ;
}
int fa[400010][21],dep[400010];
void dfs(int u,int lst)
{
	dep[u]=dep[lst]+1;
	fa[u][0]=lst;
	for(int i=1;i<=20;i++)
		fa[u][i]=fa[fa[u][i-1]][i-1];
	for(int i=first[u];i;i=e[i].nxt)
		if(e[i].v!=lst)dfs(e[i].v,u);
	return ;
}
int getlca(int x,int y)
{
	if(dep[x]<dep[y])swap(x,y);
	int need=dep[x]-dep[y],now=0;
	while(need){
		if(need&1)x=fa[x][now];
		now++;need>>=1;
	}
	if(x==y)return x;
	for(int i=20;i>=0;i--)
		if(fa[x][i]!=fa[y][i])
			x=fa[x][i],y=fa[y][i];
	return fa[x][0];
}
int jump(int u,int x)
{
	int now=0;
	while(x)
	{
		if(x&1)u=fa[u][now];
		now++;x>>=1;
	}
	return u;
}
int walk(int u,int v,int x)
{
	int lca=getlca(u,v);
	if(dep[u]-dep[lca]>=x)return jump(u,x);
	return jump(v,dep[u]+dep[v]-dep[lca]*2-x);
}
int col[400010];
int f[400010];
bool vis[400010];
int find(int x)
{
	return f[x]==x?x:f[x]=find(f[x]);
}
bool merge(int x,int y)
{
	int f1=find(x),f2=find(y);
	if(f1==f2)return false;
	f[f2]=f1;
	return true;
}
void DFS(int u,int lst,int o,int dep)
{
	if(u!=o){
		if(vis[u])return ;
		if(col[u]){
			merge(o,col[u]);
			return ;
		}
		col[u]=o;merge(u,o);
	}
	if(!dep)return ;
	for(int i=first[u];i;i=e[i].nxt)
		if(e[i].v!=lst)DFS(e[i].v,u,o,dep-1);
	return ;
}
int n,k,r;
int a[200010];
bool solve()
{
	int x,y;scanf("%d %d",&x,&y);
	int lca=getlca(x,y);
	if(dep[x]+dep[y]-2*dep[lca]<=2*k)return true;
	if(find(walk(x,y,k))==find(walk(y,x,k)))
		return true;
	return false;
}
int main()
{
	scanf("%d %d %d",&n,&k,&r);
	int N=n;
	for(int i=1;i<n;i++)
	{
		int u,v;
		scanf("%d %d",&u,&v);
		N++;
		build(u,N);build(N,u);
		build(v,N);build(N,v);
	}
	for(int i=1;i<=r;i++)
	{
		scanf("%d",&a[i]);
		vis[a[i]]=true;
	}
	for(int i=1;i<=N;i++)f[i]=i;
	dfs(1,0);
	for(int i=1;i<=r;i++)
		DFS(a[i],0,a[i],k);
	int q;scanf("%d",&q);
	while(q--){
		if(solve())printf("YES\n");
		else printf("NO\n");
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;

const int inf=1000000000;
bool bo[200010];
int dfn[200010],tp[200010],siz[200010],n,k,r,hd[200010],cnt,fa[200010],dep[200010],Fa[200010],bel[200010],x,y,f[200010][18],q[200010],l,p[200010];
struct node{int to,next;}e[400010];
struct seg{int l,r; pair<int,int> mi;}t[800010];

int ask(int x) {return Fa[x]==x?x:Fa[x]=ask(Fa[x]);}

void dfs(int x)
{
	siz[x]=1;
	dep[x]=dep[fa[x]]+1;
	for (int i=hd[x]; i; i=e[i].next)
		if (e[i].to!=fa[x]) fa[e[i].to]=x,dfs(e[i].to),siz[x]+=siz[e[i].to];
}

void Dfs(int x)
{
	dfn[x]=(++cnt); int ma=0,maa;
	for (int i=hd[x]; i; i=e[i].next)
		if (e[i].to!=fa[x]&&siz[e[i].to]>ma) ma=siz[e[i].to],maa=e[i].to;
	if (!ma) return;
	tp[maa]=tp[x],Dfs(maa);
	for (int i=hd[x]; i; i=e[i].next)
		if (e[i].to!=fa[x]&&e[i].to!=maa) tp[e[i].to]=e[i].to,Dfs(e[i].to);
}

int lca(int x,int y)
{
	if (dep[x]<dep[y]) swap(x,y);
	for (int j=17; j>=0; j--)
		if (dep[f[x][j]]>=dep[y]) x=f[x][j];
	if (x==y) return x;
	for (int j=17; j>=0; j--)
		if (f[x][j]!=f[y][j]) x=f[x][j],y=f[y][j];
	return fa[x];
}

int getdis(int x,int y) {return dep[x]+dep[y]-2*dep[lca(x,y)];}

void build(int i,int l,int r)
{
	t[i].l=l,t[i].r=r,t[i].mi=make_pair(inf,0);
	if (l==r) return;
	int mid=(l+r)>>1;
	build(i<<1,l,mid),build(i<<1|1,mid+1,r);
}

void change(int i,int x,pair<int,int> v)
{
	if (t[i].l==t[i].r) {t[i].mi=v; return;}
	int mid=(t[i].l+t[i].r)>>1;
	change(i<<1|(x>mid),x,v);
	t[i].mi=min(t[i<<1].mi,t[i<<1|1].mi);
}

pair<int,int> query(int i,int l,int r)
{
	if (t[i].l==l&&t[i].r==r) return t[i].mi;
	int mid=(t[i].l+t[i].r)>>1;
	if (r<=mid) return query(i<<1,l,r);
	if (l>mid) return query(i<<1|1,l,r);
	return min(query(i<<1,l,mid),query(i<<1|1,mid+1,r));
}

void add(int x)
{
	int nw=-dep[x],X=x;
	while (x&&p[x]==inf) p[x]=nw,change(1,dfn[x],make_pair(nw,X)),x=fa[x],nw+=2;
}

int query(int x)
{
	int X=x;
	pair<int,int> ans=make_pair(inf,0);
	while (x)
	{
		ans=min(ans,query(1,dfn[tp[x]],dfn[x]));
		x=fa[tp[x]];
	}
	x=X;
	if (ans.first+dep[x]>k) return 0;
	return ans.second;
}

int main()
{
	scanf("%d%d%d",&n,&k,&r);
	for (int i=1; i<n; i++)
	{
		scanf("%d%d",&x,&y);
		e[++cnt]=(node){y,hd[x]},hd[x]=cnt;
		e[++cnt]=(node){x,hd[y]},hd[y]=cnt;
	}
	for (int i=1; i<=r; i++) scanf("%d",&x),bo[x]=1;
	for (int i=1; i<=n; i++) p[i]=inf;
	dfs(1),cnt=0,tp[1]=1,Dfs(1),build(1,1,n);
	for (int i=1; i<=n; i++) f[i][0]=fa[i];
	for (int j=1; j<=17; j++)
		for (int i=1; i<=n; i++)
			f[i][j]=f[f[i][j-1]][j-1];
	q[l=r=1]=1;
	while (l<=r)
	{
		x=q[l++];
		if (bo[x])
		{
			Fa[x]=query(x);
			if (!Fa[x]) Fa[x]=x;
			bel[x]=Fa[x],add(x);
		} else
		{
			bel[x]=query(x);
			if (!bel[x]) bel[x]=x;
			Fa[x]=x;
		}
		for (int i=hd[x]; i; i=e[i].next)
			if (e[i].to!=fa[x]) q[++r]=e[i].to;
	}
	scanf("%d",&r);
	while (r--)
	{
		scanf("%d%d",&x,&y);
		if (getdis(x,y)<=k) {puts("YES"); continue;}
		int xx=ask(bel[x]),yy=ask(bel[y]);
		if (xx==yy||getdis(x,yy)<=k||getdis(xx,y)<=k) puts("YES");
		else puts("NO");
	}
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

typedef unsigned long long ULL;
typedef long long LL;
typedef pair<int, int> pr;
typedef pair<LL, LL> lpr;
typedef pair<double, double> dpr;
typedef pair<long double, long double> ldpr;
//typedef complex<double> cp;

#define dbgs(x) #x << " = " << x
#define dbgs2(x, y) dbgs(x) << ", " << dbgs(y)
#define dbgs3(x, y, z) dbgs2(x, y) << ", " << dbgs(z)
#define dbgs4(w, x, y, z) dbgs3(w, x, y) << ", " << dbgs(z)

#define mst(s, x) memset(s, x, sizeof(s))
#define fi first
#define se second
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define mp make_pair
#define all(x) x.begin(), x.end()
#define unq(x) x.erase(unique(x.begin(), x.end()), x.end())
#define rg register
#define fp(i, a, b) for (rg int i = (a), I = (b) + 1; i < I; ++i)
#define fd(i, a, b) for (rg int i = (a), I = (b)-1; i > I; --i)
//#define ub upper_bound
//#define lb lower_bound
#define bitcount __builtin_popcount
//#define sqr(x) ((x)*(x))

#define mid ((l+r)>>1)

#define go(u) for (rg int i = pre[u], v = e[i].v; i; i = e[i].next, v = e[i].v)
#define gow(u) for (rg LL i = pre[u], v = e[i].v, w = e[i].w; i; i = e[i].next, v = e[i].v, w = e[i].w)
#define EDGE(N,M) struct edge{int u,v,w,next;}e[M];int pre[N],edge_cnt=0;void addedge(int u,int v,int w=0){edge_cnt=edge_cnt+1,e[edge_cnt]={u,v,w,pre[u]},pre[u]=edge_cnt;}
#define CLEAR_EDGE(N) {edge_cnt=0,memset(pre,0,sizeof(int)*(N+1));}

#define MAXSIZE (1 << 20)
#define isdigit(x) (x >= '0' && x <= '9')
#define FASTIO struct IO { char buf[MAXSIZE], *p1, *p2;char pbuf[MAXSIZE], *pp;     IO() : p1(buf), p2(buf), pp(pbuf){}     ~IO() { fwrite(pbuf, 1, pp - pbuf, stdout); }     inline char gc()     {         if (p1 == p2)             p2 = (p1 = buf) + fread(buf, 1, MAXSIZE, stdin);         return p1 == p2 ? -1 : *p1++;     }     inline bool blank(char ch)     {         return ch == ' ' || ch == '\n' || ch == '\r' || ch == '\t';     }     template <class T>     inline void read(T &x)     {         register double tmp = 1;         register bool sign = 0;         x = 0;         register char ch = gc();         for (; !isdigit(ch); ch = gc())             if (ch == '-')                 sign = 1;         for (; isdigit(ch); ch = gc())             x = x * 10 + (ch - '0');         if (ch == '.')             for (ch = gc(); isdigit(ch); ch = gc())                 tmp /= 10.0, x += tmp * (ch - '0');         if (sign)             x = -x;     }     inline void read(char *s)     {         register char ch = gc();         for (; blank(ch); ch = gc())             ;         for (; !blank(ch); ch = gc())             *s++ = ch;         *s = 0;     }     inline void read(char &c)     {         for (c = gc(); blank(c); c = gc())             ;     }     inline void push(const char &c)     {         if (pp - pbuf == MAXSIZE)             fwrite(pbuf, 1, MAXSIZE, stdout), pp = pbuf;         *pp++ = c;     }     template <class T>     inline void write(T x)     {         if (x < 0)             x = -x, push('-');         static T sta[35];         T top = 0;         do         {             sta[top++] = x % 10, x /= 10;         } while (x);         while (top)             push(sta[--top] + '0');     }     template <class T>     inline void write(T x, char lastChar)     {         write(x), push(lastChar);     } } io

#define MUC int _CASE;scanf("%d",&_CASE);while(_CASE--)

const int next_x[8] = {0, 1, -1, 0, 1, 1, -1, -1};
const int next_y[8] = {1, 0, 0, -1, 1, -1, -1, 1};
const int inf = 1e9+5;//7;
const LL linf = 1e18 + 5;
const double PI = acos(-1.0);
const long double eps = 1e-6;

const int MAXN = 4e5+5;
const int N = 1e6;

const LL fix = 1e12;
//const int K = 30;

#define ls (cnt<<1)
#define rs (cnt<<1|1)

/*----------head----------*/

EDGE(MAXN,MAXN*2);
namespace lca
{
    //判断点x在u到v的路径上 -> dis(u,x)+dis(x,v)==dis(u,v)
    int n,f[MAXN][25],d[MAXN];
    void dfs(int u)
    {
        go(u)if(v!=f[u][0])
            f[v][0]=u,d[v]=d[u]+1,dfs(v);
    }
    void init()
    {
        d[1]=1,dfs(1);
        for(int k=1;k<=20;k++)
            for(int i=1;i<=n;i++)
                f[i][k]=f[f[i][k-1]][k-1];
    }
    pr query(int u,int v) //返回{lca(u,v),dis(u,v)}
    {
        int tu=u,tv=v;
        if(d[u]<d[v]) swap(u,v),swap(tu,tv);
        for(int k=log2(d[u])+1;k>=0;k--)
            if(d[f[u][k]]>=d[v])
                u=f[u][k];
        if(u==v) return {tv,d[tu]-d[tv]};
        for(int k=log2(d[u])+1;k>=0;k--)
            if(f[u][k]!=f[v][k])
                u=f[u][k],v=f[v][k];
        int l=f[u][0];
        return {l,d[tu]+d[tv]-2*d[l]};
    }
    int kth_fa(int u,int k) //k级祖先 需保证存在
    {
        fd(i,20,0)
            if((1<<i)&k)
                u=f[u][i];
        return u;
    }
    int move(int u,int v,int k) //u向v走k步 需保证dis(u,v)>=k
    {
        pr t=query(u,v); int l=t.fi;
        if(d[u]-d[l]>=k)return kth_fa(u,k);
        return kth_fa(v,t.se-k);
    }
}

int n,m,k;
int f[MAXN],bel[MAXN],dis[MAXN];
int find(int x){return f[x]==x?x:f[x]=find(f[x]);}
void merge(int a,int b)
{
    if(find(a)==find(b))return;
    f[find(b)]=find(a);
}
int work()
{
    scanf("%d%d%d",&n,&k,&m);
    fp(i,1,n)f[i]=i;
    fp(i,1,n-1)
    {
        int u,v;scanf("%d%d",&u,&v);
        addedge(u,n+i),addedge(n+i,u);
        addedge(v,n+i),addedge(n+i,v);
    }
    lca::n=2*n,lca::init(); queue<int> q;
    fp(i,1,m)
    {
        int u;scanf("%d",&u);
        q.push(u),dis[u]=1,bel[u]=u;
    }
    while(!q.empty())
    {
        int u=q.front(); q.pop();
        if(dis[u]-1==k) continue;
        go(u)if(!dis[v])dis[v]=dis[u]+1,q.push(v),bel[v]=bel[u];
        else if(dis[u]+dis[v]-2<=2*k)merge(bel[u],bel[v]);
    }
    MUC
    {
        int u,v;scanf("%d%d",&u,&v);
        pr t=lca::query(u,v);
        if(t.se<=2*k){puts("YES");continue;}
        int a=lca::move(u,v,k),b=lca::move(v,u,k);
        int aa=bel[a]?find(bel[a]):0;
        int bb=bel[b]?find(bel[b]):0;
        puts(aa&&bb&&aa==bb?"YES":"NO");
    }
    return 0;
}

// reverse vector 注意判空 不然会re
// 分块注意维护块上标记 来更新块内数组a[]
// vector+lower_bound常数 < map/set
// map.find不会创建新元素 map[]会 注意空间
// 别对指针用memset
// 用位运算表示2^n注意加LL  1LL<<20
// 注意递归爆栈
// 注意边界
// 注意memset 多组样例会T

//#define ONLINE_JUDGE

int main()
{
    //ios::sync_with_stdio(false);
    //cin.tie(0);
#ifdef ONLINE_JUDGE
    //freopen("invazia.in", "r",stdin );
    //freopen("invazia.out","w",stdout);
#endif // ONLINE_JUDGE
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
#endif
    work();
#ifndef ONLINE_JUDGE
    freopen("CON", "r", stdin);
    freopen("CON", "w", stdout);
    fflush(stdout);
    cout << "time:" << clock() << "ms" << endl;
    system("pause");
#endif
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
const int N=400005,inf=1e9+7;
int n,k,r,q,dep[N],fa[20][N],f[N],d[N];
vector<int>g[N];
int fnd(int x){return f[x]==x?x:f[x]=fnd(f[x]);}
void dfs(int x,int p)
{
	fa[0][x]=p;for(int i=1;i<19;i++)fa[i][x]=fa[i-1][fa[i-1][x]];
	for(int y:g[x])if(y!=p)dep[y]=dep[x]+1,dfs(y,x);
}
inline int anc(int x,int d){for(int i=18;~i;i--)if(d>>i&1)x=fa[i][x];return x;}
inline int lca(int u,int v)
{
	if(dep[u]<dep[v])swap(u,v);u=anc(u,dep[u]-dep[v]);if(u==v)return u;
	for(int i=18;~i;i--)if(fa[i][u]!=fa[i][v])u=fa[i][u],v=fa[i][v];return fa[0][u];
}
inline int go(int u,int v,int t,int k){return (k<=dep[u]-dep[t])?anc(u,k):anc(v,dep[v]-dep[t]-(k-(dep[u]-dep[t])));}
inline bool sol()
{
	int u,v,t;scanf("%d%d",&u,&v);t=lca(u,v);
	return (dep[u]+dep[v]-2*dep[t]<=2*k)?1:(fnd(go(u,v,t,k))==fnd(go(v,u,t,k)));
}
int main()
{
	scanf("%d%d%d",&n,&k,&r);int nn=n;
	for(int i=1,u,v;i<n;i++)
	{
		scanf("%d%d",&u,&v);nn++;
		g[u].push_back(nn);g[v].push_back(nn);
		g[nn].push_back(u);g[nn].push_back(v);
	}
	for(int i=1;i<=nn;i++)f[i]=i,d[i]=inf;
	queue<int>Q;
	for(int i=1,x;i<=r;i++)scanf("%d",&x),d[x]=0,Q.push(x);
	while(!Q.empty())
	{
		int x=Q.front();Q.pop();
		if(d[x]>=k)break;
		for(int y:g[x])
		{
			f[fnd(y)]=fnd(x);
			if(d[y]==inf){d[y]=d[x]+1;Q.push(y);}
		}
	}
	dfs(1,0);scanf("%d",&q);
	while(q--)puts(sol()?"YES":"NO");
	return 0;
}


#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include <bits/stdc++.h>

#define MAX_N 500005
#define f first
#define s second

using namespace std;

typedef pair<int, int> ii;
typedef pair<ii, int> pii;

void fastscan(int &number)
{
    //variable to indicate sign of input number
    bool negative = false;
    register int c;

    number = 0;

    // extract current character from buffer
    c = getchar();
    if (c=='-')
    {
        // number is negative
        negative = true;

        // extract the next character from the buffer
        c = getchar();
    }

    // Keep on extracting characters if they are integers
    // i.e ASCII Value lies from '0'(48) to '9' (57)
    for (; (c>47 && c<58); c=getchar())
        number = number *10 + c - 48;

    // if scanned input has a negative sign, negate the
    // value of the input number
    if (negative)
        number *= -1;
}

vector<int> con[MAX_N];

int ar[MAX_N], par[MAX_N], dist[MAX_N], sz[MAX_N], depth[MAX_N];
int p[32][MAX_N];

int N, K, R, Q;

void init(int size) {
    for (int i = 0; i < size; i ++) {
        par[i] = i;
        sz[i] = 1;
    }
}

int find(int x) {
    while (x != par[x]) {
        par[x] = par[par[x]];
        x = par[x];
    }

    return (x);
}

void merge(int x, int y) {
    x = find(x);
    y = find(y);

    if (x == y)
        return;

    if (sz[x] > sz[y]) {
        par[y] = x;
        sz[x] += sz[y];
    }

    else {
        par[x] = y;
        sz[y] += sz[x];
    }
}

void DFS (int ind, int pa, int d) {
    depth[ind] = d;
    p[0][ind] = pa;

    for (int i = 1; i <= 20; i ++)
        p[i][ind] = p[i - 1][p[i - 1][ind]];

    for (int i = 0; i < con[ind].size(); i ++)
        if (!depth[con[ind][i]])
            DFS(con[ind][i], ind, d + 1);
}

int lca(int a, int b) {
    int tmp;
    int c;

    if (depth[a] < depth[b]) {
        tmp = a;
        a = b; b = tmp;
    }

    c = depth[a] - depth[b];

    for (int i = 0; i <= 20; i ++)
        if ((c >> i) & 1)
            a = p[i][a];

    if (a == b)
        return (a);

    for (int i = 20; i >= 0; i --) {
        if (p[i][a] != p[i][b]) {
            a = p[i][a];
            b = p[i][b];
        }
    }

    return (p[0][a]);
}

int walk(int start, int dest, int length) {
    int cur = lca(start, dest);

    if (depth[start] - depth[cur] >= length) {
        int d = (length);
        int a = start;

        for (int i = 0; i <= 20; i ++)
            if ((d >> i) & 1)
                a = p[i][a];

        return (a);
    }

    int excess = length - (depth[start] - depth[cur]);
    int d = (depth[dest] - depth[cur] - excess);
    int a = dest;

    for (int i = 0; i <= 20; i ++)
        if ((d >> i) & 1)
            a = p[i][a];

    return (a);
}

void solve() {
    cin >> N >> K >> R;

    int a, b;
    int dummy = N;
    for (int i = 0; i < N - 1; i ++) {
        cin >> a >> b;
        con[a - 1].push_back(dummy);
        con[dummy].push_back(a - 1);
        con[b - 1].push_back(dummy);
        con[dummy].push_back(b - 1);

        dummy ++;
    }

    N = dummy;
    init(MAX_N);
    DFS(0, 0, 1);

    queue<int> q;

    for (int i = 0; i < N; i ++)
        dist[i] = 2000000009;

    int x;
    for (int i = 0; i < R; i ++) {
        cin >> x; x --;
        dist[x] = 0;
        q.push(x);
    }

    while (!q.empty()) {
        int c = q.front();
        q.pop();

        if (dist[c] >= K)
            break;

        for (int i = 0; i < con[c].size(); i ++) {
            merge(c, con[c][i]);

            if (dist[c] + 1 < dist[con[c][i]]) {
                dist[con[c][i]] = dist[c] + 1;
                q.push(con[c][i]);
            }
        }
    }

    cin >> Q;
    for (int i = 0; i < Q; i ++) {
        cin >> a >> b;
        a --; b --;

        if (depth[a] + depth[b] - 2 * depth[lca(a, b)] <= 2 * K)
            cout << "YES" << endl;
        else {
            int node1 = walk(a, b, K);
            int node2 = walk(b, a, K);

            if (find(node1) == find(node2))
                cout << "YES" << endl;
            else
                cout << "NO" << endl;
        }
    }
}

int main() {
    int T;
    T = 1;

    for (int i = 0; i < T; i ++)
        solve();

    return (0);
}


#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include <bits/stdc++.h>

#define MAX_N 500005
#define f first
#define s second

using namespace std;

typedef pair<int, int> ii;
typedef pair<ii, int> pii;

void fastscan(int &number)
{
    //variable to indicate sign of input number
    bool negative = false;
    register int c;

    number = 0;

    // extract current character from buffer
    c = getchar();
    if (c=='-')
    {
        // number is negative
        negative = true;

        // extract the next character from the buffer
        c = getchar();
    }

    // Keep on extracting characters if they are integers
    // i.e ASCII Value lies from '0'(48) to '9' (57)
    for (; (c>47 && c<58); c=getchar())
        number = number *10 + c - 48;

    // if scanned input has a negative sign, negate the
    // value of the input number
    if (negative)
        number *= -1;
}

vector<int> con[MAX_N];

int ar[MAX_N], par[MAX_N], dist[MAX_N], sz[MAX_N], depth[MAX_N];
int p[32][MAX_N];

int N, K, R, Q;

void init(int size) {
    for (int i = 0; i < size; i ++) {
        par[i] = i;
        sz[i] = 1;
    }
}

int find(int x) {
    while (x != par[x]) {
        par[x] = par[par[x]];
        x = par[x];
    }

    return (x);
}

void merge(int x, int y) {
    x = find(x);
    y = find(y);

    if (x == y)
        return;

    if (sz[x] > sz[y]) {
        par[y] = x;
        sz[x] += sz[y];
    }

    else {
        par[x] = y;
        sz[y] += sz[x];
    }
}

void DFS (int ind, int pa, int d) {
    depth[ind] = d;
    p[0][ind] = pa;

    for (int i = 1; i <= 20; i ++)
        p[i][ind] = p[i - 1][p[i - 1][ind]];

    for (int i = 0; i < con[ind].size(); i ++)
        if (!depth[con[ind][i]])
            DFS(con[ind][i], ind, d + 1);
}

int lca(int a, int b) {
    int tmp;
    int c;

    if (depth[a] < depth[b]) {
        tmp = a;
        a = b; b = tmp;
    }

    c = depth[a] - depth[b];

    for (int i = 0; i <= 20; i ++)
        if ((c >> i) & 1)
            a = p[i][a];

    if (a == b)
        return (a);

    for (int i = 20; i >= 0; i --) {
        if (p[i][a] != p[i][b]) {
            a = p[i][a];
            b = p[i][b];
        }
    }

    return (p[0][a]);
}

int walk(int start, int dest, int length) {
    int cur = lca(start, dest);

    if (depth[start] - depth[cur] >= length) {
        int d = (length);
        int a = start;

        for (int i = 0; i <= 20; i ++)
            if ((d >> i) & 1)
                a = p[i][a];

        return (a);
    }

    int excess = length - (depth[start] - depth[cur]);
    int d = (depth[dest] - depth[cur] - excess);
    int a = dest;

    for (int i = 0; i <= 20; i ++)
        if ((d >> i) & 1)
            a = p[i][a];

    return (a);
}

void solve() {
    fastscan(N);
    fastscan(K);
    fastscan(R);

    int a, b;
    int dummy = N;
    for (int i = 0; i < N - 1; i ++) {
        fastscan(a);
        fastscan(b);
        con[a - 1].push_back(dummy);
        con[dummy].push_back(a - 1);
        con[b - 1].push_back(dummy);
        con[dummy].push_back(b - 1);

        dummy ++;
    }

    N = dummy;
    init(MAX_N);
    DFS(0, 0, 1);

    queue<int> q;

    for (int i = 0; i < N; i ++)
        dist[i] = 2000000009;

    int x;
    for (int i = 0; i < R; i ++) {
        cin >> x; x --;
        dist[x] = 0;
        q.push(x);
    }

    while (!q.empty()) {
        int c = q.front();
        q.pop();

        if (dist[c] >= K)
            break;

        for (int i = 0; i < con[c].size(); i ++) {
            merge(c, con[c][i]);

            if (dist[c] + 1 < dist[con[c][i]]) {
                dist[con[c][i]] = dist[c] + 1;
                q.push(con[c][i]);
            }
        }
    }

    fastscan(Q);
    for (int i = 0; i < Q; i ++) {
        fastscan(a);
        fastscan(b);
        a --; b --;

        if (depth[a] + depth[b] - 2 * depth[lca(a, b)] <= 2 * K)
            cout << "YES" << endl;
        else {
            int node1 = walk(a, b, K);
            int node2 = walk(b, a, K);

            if (find(node1) == find(node2))
                cout << "YES" << endl;
            else
                cout << "NO" << endl;
        }
    }
}

int main() {
    int T;
    T = 1;

    for (int i = 0; i < T; i ++)
        solve();

    return (0);
}


#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include <bits/stdc++.h>

#define MAX_N 500005
#define f first
#define s second

using namespace std;

typedef pair<int, int> ii;
typedef pair<ii, int> pii;

void fastscan(int &number)
{
    //variable to indicate sign of input number
    bool negative = false;
    register int c;

    number = 0;

    // extract current character from buffer
    c = getchar();
    if (c=='-')
    {
        // number is negative
        negative = true;

        // extract the next character from the buffer
        c = getchar();
    }

    // Keep on extracting characters if they are integers
    // i.e ASCII Value lies from '0'(48) to '9' (57)
    for (; (c>47 && c<58); c=getchar())
        number = number *10 + c - 48;

    // if scanned input has a negative sign, negate the
    // value of the input number
    if (negative)
        number *= -1;
}

vector<int> con[MAX_N];

int ar[MAX_N], par[MAX_N], dist[MAX_N], sz[MAX_N], depth[MAX_N];
int p[32][MAX_N];

int N, K, R, Q;

void init(int size) {
    for (int i = 0; i < size; i ++) {
        par[i] = i;
        sz[i] = 1;
    }
}

int find(int x) {
    while (x != par[x]) {
        par[x] = par[par[x]];
        x = par[x];
    }

    return (x);
}

void merge(int x, int y) {
    x = find(x);
    y = find(y);

    if (x == y)
        return;

    if (sz[x] > sz[y]) {
        par[y] = x;
        sz[x] += sz[y];
    }

    else {
        par[x] = y;
        sz[y] += sz[x];
    }
}

void DFS (int ind, int pa, int d) {
    depth[ind] = d;
    p[0][ind] = pa;

    for (int i = 1; i <= 20; i ++)
        p[i][ind] = p[i - 1][p[i - 1][ind]];

    for (int i = 0; i < con[ind].size(); i ++)
        if (!depth[con[ind][i]])
            DFS(con[ind][i], ind, d + 1);
}

int lca(int a, int b) {
    int tmp;
    int c;

    if (depth[a] < depth[b]) {
        tmp = a;
        a = b; b = tmp;
    }

    c = depth[a] - depth[b];

    for (int i = 0; i <= 20; i ++)
        if ((c >> i) & 1)
            a = p[i][a];

    if (a == b)
        return (a);

    for (int i = 20; i >= 0; i --) {
        if (p[i][a] != p[i][b]) {
            a = p[i][a];
            b = p[i][b];
        }
    }

    return (p[0][a]);
}

int walk(int start, int dest, int length) {
    int cur = lca(start, dest);

    if (depth[start] - depth[cur] >= length) {
        int d = (length);
        int a = start;

        for (int i = 0; i <= 20; i ++)
            if ((d >> i) & 1)
                a = p[i][a];

        return (a);
    }

    int excess = length - (depth[start] - depth[cur]);
    int d = (depth[dest] - depth[cur] - excess);
    int a = dest;

    for (int i = 0; i <= 20; i ++)
        if ((d >> i) & 1)
            a = p[i][a];

    return (a);
}

void solve() {
    fastscan(N);
    fastscan(K);
    fastscan(R);

    int a, b;
    int dummy = N;
    for (int i = 0; i < N - 1; i ++) {
        fastscan(a);
        fastscan(b);
        con[a - 1].push_back(dummy);
        con[dummy].push_back(a - 1);
        con[b - 1].push_back(dummy);
        con[dummy].push_back(b - 1);

        dummy ++;
    }

    N = dummy;
    init(MAX_N);
    DFS(0, 0, 1);

    queue<int> q;

    for (int i = 0; i < N; i ++)
        dist[i] = 2000000009;

    int x;
    for (int i = 0; i < R; i ++) {
        fastscan(x); x --;
        dist[x] = 0;
        q.push(x);
    }

    while (!q.empty()) {
        int c = q.front();
        q.pop();

        if (dist[c] >= K)
            break;

        for (int i = 0; i < con[c].size(); i ++) {
            merge(c, con[c][i]);

            if (dist[c] + 1 < dist[con[c][i]]) {
                dist[con[c][i]] = dist[c] + 1;
                q.push(con[c][i]);
            }
        }
    }

    fastscan(Q);
    for (int i = 0; i < Q; i ++) {
        fastscan(a);
        fastscan(b);
        a --; b --;

        if (depth[a] + depth[b] - 2 * depth[lca(a, b)] <= 2 * K)
            cout << "YES" << endl;
        else {
            int node1 = walk(a, b, K);
            int node2 = walk(b, a, K);

            if (find(node1) == find(node2))
                cout << "YES" << endl;
            else
                cout << "NO" << endl;
        }
    }
}

int main() {
    int T;
    T = 1;

    for (int i = 0; i < T; i ++)
        solve();

    return (0);
}


//Arayi
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <math.h>
#include <vector>
#include <cstring>
#include <ctime>
#include <set>
#include <bitset>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <ctime>
#include <climits>
#include <cassert>
#include <chrono>
#include <random>
#include <complex>

#define fr first
#define sc second
#define MP make_pair
#define ad push_back
#define PB push_back
#define fastio ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define lli long long int
#define y1 arayikhalatyan
#define j1 jigglypuff
#define ld long double
#define itn int
#define pir pair<int, int>
#define all(x) (x).begin(), (x).end()
#define str string
#define enl endl
#define en endl
#define cd complex<long double>
#define vcd vector<cd>
#define vii vector<int>
#define vlli vector<lli>
using namespace std;

lli gcd(lli a, lli b) { return (b == 0LL ? a : gcd(b, a % b)); }
ld dist(ld x, ld y1, ld x2, ld y2)
{
    return sqrt((x - x2) * (x - x2) + (y1 - y2) * (y1 - y2));
}
lli S(lli a)
{
    return (a * (a + 1LL)) / 2;
}
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
char vow[] = { 'a', 'e', 'i', 'o', 'u' };
int dx[] = { 0, -1, 0, 1, -1, -1, 1, 1, 0 };
int dy[] = { -1, 0, 1, 0, -1, 1, -1, 1, 0 };

const int N = 2e6 + 30;
const lli mod = 1e9 + 7;
const ld pi = acos(-1);
const int T = 238;
const ld e = 1e-13;

lli bp(lli a, lli b = mod - 2LL)
{
    lli ret = 1;
    while (b)
    {
        if (b & 1) ret *= a, ret %= mod;
        a *= a;
        a %= mod;
        b >>= 1;
    }
    return ret;
}
ostream& operator<<(ostream& c, pir a)
{
    c << a.fr << " " << a.sc;
    return c;
}
struct pt
{
    lli x, y;
    int ind;
    int bl;
    bool operator==(const pt& a)
    {
        return ind == a.ind;
    }
    bool operator<(const pt& b)
    {
        if (x == b.x) return y < b.y;
        return x < b.x;
    }
};

int n, k, t;
int p[N], xr[N], pr[N][20];
bool col[N], cl[N];
queue <pir> q;
vii g[N];
int gp(int x)
{
    if (p[x] == x) return x;
    return p[x] = gp(p[x]);
}
void dfs(int v, int par, int xx)
{
    //cout << v << " " << xx << endl;
    xr[v] = xx;
    pr[v][0] = par;
    for (auto p : g[v])
    {
        if (p == par) continue;
        dfs(p, v, xx + 1);
    }
}
int walk(int u, int d)
{
    for (int i = 0; i < 20; i++)
        if (d & (1 << i)) u = pr[u][i];
    return u;
}
int lca(int v, int u)
{
    if (xr[v] > xr[u]) swap(u, v);
    u = walk(u, xr[u] - xr[v]);
    if (u == v) return u;
    for (int i = 19; i >= 0; i--)
    {
        if (pr[u][i] == pr[v][i]) continue;
        u = pr[u][i];
        v = pr[v][i];
    }
    return pr[u][0];
}
int main()
{
    fastio;
    cin >> n >> k >> t;
    for (int i = 0; i < n - 1; i++)
    {
        int a, b;
        cin >> a >> b;
        g[a].ad(n + i + 1);
        g[n + i + 1].ad(a);
        g[b].ad(n + i + 1);
        g[n + i + 1].ad(b);
    }
    for (int i = 0; i < t; i++)
    {
        int x;
        cin >> x;
        q.push({ x,0 });
        cl[x] = col[x] = 1;
    }
    dfs(1, 1, 0);
    for (int i = 1; i < 20; i++)
        for (int j = 1; j < 2 * n; j++)
            pr[j][i] = pr[pr[j][i - 1]][i - 1], p[j] = j;
    while (!q.empty())
    {
        int v = q.front().fr;
        int d = q.front().sc;
        q.pop();
        if (d == k) continue;
        for (auto p1 : g[v])
        {
            if (col[p1])
            {
                p[gp(p1)] = gp(v);
            }
            else
            {
                col[p1] = 1;
                q.push(MP(p1, d + 1));
                p[p1] = gp(v);
            }
        }
    }
    cin >> t;
    while (t--)
    {
        int a, b;
        cin >> a >> b;
        int c = lca(a, b);
        //cout << a << " " << b << enl << xr[a] << " " << xr[b] << endl;
        if (xr[a] + xr[b] - xr[c] - xr[c] <= k + k)
        {
            cout << "YES\n";
            continue;
        }
        if (xr[a] < xr[b]) swap(a, b);
        a = walk(a, k);
        if (xr[b] - xr[c] < k)
            b = walk(a, xr[a] - xr[c] - k + xr[b] - xr[c]);
        else
            b = walk(b, k);
        //cout << a << " " << b << endl;
        if (gp(a) == gp(b)) cout << "YES\n";
        else cout << "NO\n";
    }
    return 0;
}

/*

  __
*(><)*
  \/ /
  ||/
--||
  ||
  /\
 /  \
/    \
*/


//Arayi
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <math.h>
#include <vector>
#include <cstring>
#include <ctime>
#include <set>
#include <bitset>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <ctime>
#include <climits>
#include <cassert>
#include <chrono>
#include <random>
#include <complex>

#define fr first
#define sc second
#define MP make_pair
#define ad push_back
#define PB push_back
#define fastio ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define lli long long int
#define y1 arayikhalatyan
#define j1 jigglypuff
#define ld long double
#define itn int
#define pir pair<int, int>
#define all(x) (x).begin(), (x).end()
#define str string
#define enl endl
#define en endl
#define cd complex<long double>
#define vcd vector<cd>
#define vii vector<int>
#define vlli vector<lli>
using namespace std;

lli gcd(lli a, lli b) { return (b == 0LL ? a : gcd(b, a % b)); }
ld dist(ld x, ld y1, ld x2, ld y2)
{
    return sqrt((x - x2) * (x - x2) + (y1 - y2) * (y1 - y2));
}
lli S(lli a)
{
    return (a * (a + 1LL)) / 2;
}
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
char vow[] = { 'a', 'e', 'i', 'o', 'u' };
int dx[] = { 0, -1, 0, 1, -1, -1, 1, 1, 0 };
int dy[] = { -1, 0, 1, 0, -1, 1, -1, 1, 0 };

const int N = 2e6 + 30;
const lli mod = 1e9 + 7;
const ld pi = acos(-1);
const int T = 238;
const ld e = 1e-13;

lli bp(lli a, lli b = mod - 2LL)
{
    lli ret = 1;
    while (b)
    {
        if (b & 1) ret *= a, ret %= mod;
        a *= a;
        a %= mod;
        b >>= 1;
    }
    return ret;
}
ostream& operator<<(ostream& c, pir a)
{
    c << a.fr << " " << a.sc;
    return c;
}
struct pt
{
    lli x, y;
    int ind;
    int bl;
    bool operator==(const pt& a)
    {
        return ind == a.ind;
    }
    bool operator<(const pt& b)
    {
        if (x == b.x) return y < b.y;
        return x < b.x;
    }
};

int n, k, t;
int p[N], xr[N], pr[N][20];
bool col[N], cl[N];
queue <pir> q;
vii g[N];
int gp(int x)
{
    if (p[x] == x) return x;
    return p[x] = gp(p[x]);
}
void dfs(int v, int par, int xx)
{
    //cout << v << " " << xx << endl;
    xr[v] = xx;
    pr[v][0] = par;
    for (auto p : g[v])
    {
        if (p == par) continue;
        dfs(p, v, xx + 1);
    }
}
int walk(int u, int d)
{
    for (int i = 0; i < 20; i++)
        if (d & (1 << i)) u = pr[u][i];
    return u;
}
int lca(int v, int u)
{
    if (xr[v] > xr[u]) swap(u, v);
    u = walk(u, xr[u] - xr[v]);
    if (u == v) return u;
    for (int i = 19; i >= 0; i--)
    {
        if (pr[u][i] == pr[v][i]) continue;
        u = pr[u][i];
        v = pr[v][i];
    }
    return pr[u][0];
}
int main()
{
    fastio;
    cin >> n >> k >> t;
    for (int i = 0; i < n - 1; i++)
    {
        int a, b;
        cin >> a >> b;
        g[a].ad(n + i + 1);
        g[n + i + 1].ad(a);
        g[b].ad(n + i + 1);
        g[n + i + 1].ad(b);
    }
    for (int i = 0; i < t; i++)
    {
        int x;
        cin >> x;
        q.push({ x,0 });
        cl[x] = col[x] = 1;
    }
    dfs(1, 1, 0);
    for (int i = 1; i < 20; i++)
        for (int j = 1; j < 2 * n; j++)
            pr[j][i] = pr[pr[j][i - 1]][i - 1], p[j] = j;
    while (!q.empty())
    {
        int v = q.front().fr;
        int d = q.front().sc;
        q.pop();
        if (d == k) continue;
        for (auto p1 : g[v])
        {
            if (col[p1])
            {
                p[gp(p1)] = gp(v);
            }
            else
            {
                col[p1] = 1;
                q.push(MP(p1, d + 1));
                p[p1] = gp(v);
            }
        }
    }
    cin >> t;
    while (t--)
    {
        int a, b;
        cin >> a >> b;
        int c = lca(a, b);
        //cout << a << " " << b << enl << xr[a] << " " << xr[b] << endl;
        if (xr[a] + xr[b] - xr[c] - xr[c] <= k + k)
        {
            cout << "YES\n";
            continue;
        }
        if (xr[a] < xr[b]) swap(a, b);
        a = walk(a, k);
        if (xr[b] - xr[c] < k)
            b = walk(a, xr[a] - xr[c] - k + xr[b] - xr[c]);
        else
            b = walk(b, k);
        cout << a << " " << b << endl;
        if (gp(a) == gp(b)) cout << "YES\n";
        else cout << "NO\n";
    }
    return 0;
}

/*

  __
*(><)*
  \/ /
  ||/
--||
  ||
  /\
 /  \
/    \
*/


// Author -- Frame

#include<cstdio>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<algorithm>
#include<vector>
#include<iostream>

#define lowbit(x) ((x)&(-x))
#define Finline __inline__ __attribute__ ((always_inline))
#define DEBUG printf("Running on Line %d in Function %s\n",__LINE__,__FUNCTION__)

typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;

const int inf=0x3f3f3f3f,Inf=0x7fffffff;
const ll INF=0x7fffffffffffffff;
const double eps=1e-10;

uint seed=19260817;
const uint _RAND_MAX_=4294967295u;
Finline uint Rand(){return seed=seed*998244353u+1000000007u;}

template <typename _Tp>_Tp gcd(const _Tp &a,const _Tp &b){return (!b)?a:gcd(b,a%b);}
template <typename _Tp>Finline _Tp abs(const _Tp &a){return a>0?a:-a;}
template <typename _Tp>Finline _Tp max(const _Tp &a,const _Tp &b){return a<b?b:a;}
template <typename _Tp>Finline _Tp min(const _Tp &a,const _Tp &b){return a<b?a:b;}
template <typename _Tp>Finline void chmax(_Tp &a,const _Tp &b){(a<b)&&(a=b);}
template <typename _Tp>Finline void chmin(_Tp &a,const _Tp &b){(b<a)&&(a=b);}
template <typename _Tp>Finline bool _cmp(const _Tp &a,const _Tp &b){return abs(a-b)<=eps;}
template <typename _Tp>Finline void read(_Tp &x)
{
	register char ch(getchar());
	bool f(false);
	while(ch<48||ch>57) f|=ch==45,ch=getchar();
	x=ch&15,ch=getchar();
	while(ch>=48&&ch<=57) x=(((x<<2)+x)<<1)+(ch&15),ch=getchar();
	if(f) x=-x;
}
template <typename _Tp,typename... Args>Finline void read(_Tp &t,Args &...args)
{
	read(t);read(args...);
}
Finline int read_str(char *s)
{
	register char ch(getchar());
	while(ch==' '||ch=='\r'||ch=='\n') ch=getchar();
	register char *tar=s;
	*tar=ch,ch=getchar();
	while(ch!=' '&&ch!='\r'&&ch!='\n'&&ch!=EOF) *(++tar)=ch,ch=getchar();
	return tar-s+1;
}

const int N=400005;
struct edge{
	int v,nxt;
}c[N<<1];
int front[N],cnt;
Finline void add(int u,int v)
{
	c[++cnt]=(edge){v,front[u]},front[u]=cnt;
}
int f[N][21],dep[N];
void dfs(int x,int fa)
{
	f[x][0]=fa;
	dep[x]=dep[fa]+1;
	for(int i=1;i<=20;++i)
	{
		f[x][i]=f[f[x][i-1]][i-1];
	}
	for(int i=front[x];i;i=c[i].nxt)
	{
		if(c[i].v!=fa)
		{
			dfs(c[i].v,x);
		}
	}
}
int jump(int x,int k)
{
	for(int i=20;i>=0;--i)
	{
		if((k>>i)&1)
		{
			x=f[x][i];
		}
	}
	return x;
}
int lca(int x,int y)
{
	if(dep[x]<dep[y]) std::swap(x,y);
	for(int i=20;i>=0;--i)
	{
		if(dep[f[x][i]]>=dep[y])
		{
			x=f[x][i];
		}
	}
	if(x==y) return x;
	for(int i=20;i>=0;--i)
	{
		if(f[x][i]!=f[y][i])
		{
			x=f[x][i];
			y=f[y][i];
		}
	}
	return dep[x]<dep[y]?x:y;
}
int get(int x,int y,int k,int l)
{
	if(dep[x]-dep[l]>=k) return jump(x,k);
	k-=dep[x]-dep[l];
	return jump(y,dep[y]-dep[l]-k);
}
struct node{
	int x,dep;
}_q[N];
int _l,_r;
int fa[N];
int find(int x){return x==fa[x]?x:fa[x]=find(fa[x]);}
int main()
{
	int n,k,r;
	read(n,k,r);
	int node_cnt=n;
	int x,y;
	for(int i=1;i<n;++i)
	{
		++node_cnt;
		read(x,y);
		add(x,node_cnt);
		add(node_cnt,x);
		add(node_cnt,y);
		add(y,node_cnt);
	}
	dfs(1,0);
	_l=1,_r=0;
	for(int i=1;i<=r;++i)
	{
		read(x);
		_q[++_r]=(node){x,0};
		fa[x]=x;
	}
	while(_l!=_r+1)
	{
		node x=_q[_l++];
		if(x.dep>=k) break;
		for(int i=front[x.x];i;i=c[i].nxt)
		{
			if(!fa[c[i].v])
			{
				fa[c[i].v]=fa[x.x];
				_q[++_r]=(node){c[i].v,x.dep+1};
			}
			else
			{
				fa[find(c[i].v)]=find(x.x);
			}
		}
	}
	int _;
	read(_);
	while(_--)
	{
		read(x,y);
		int l=lca(x,y);
		if(dep[x]+dep[y]-(dep[l]<<1)<=(k<<1))
		{
			printf("YES\n");
			continue;
		}
		int a=get(x,y,k,l);
		int b=get(y,x,k,l);
		if(!fa[a]||!fa[b])
		{
			printf("NO\n");
			continue;
		}
		if(find(a)==find(b))
		{
			printf("YES\n");
		}
		else
		{
			printf("NO\n");
		}
	}
	return 0;
}


// Author -- Frame

#include<cstdio>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<algorithm>
#include<vector>
#include<iostream>

#define lowbit(x) ((x)&(-x))
#define Finline __inline__ __attribute__ ((always_inline))
#define DEBUG printf("Running on Line %d in Function %s\n",__LINE__,__FUNCTION__)

typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;

const int inf=0x3f3f3f3f,Inf=0x7fffffff;
const ll INF=0x7fffffffffffffff;
const double eps=1e-10;

uint seed=19260817;
const uint _RAND_MAX_=4294967295u;
Finline uint Rand(){return seed=seed*998244353u+1000000007u;}

template <typename _Tp>_Tp gcd(const _Tp &a,const _Tp &b){return (!b)?a:gcd(b,a%b);}
template <typename _Tp>Finline _Tp abs(const _Tp &a){return a>0?a:-a;}
template <typename _Tp>Finline _Tp max(const _Tp &a,const _Tp &b){return a<b?b:a;}
template <typename _Tp>Finline _Tp min(const _Tp &a,const _Tp &b){return a<b?a:b;}
template <typename _Tp>Finline void chmax(_Tp &a,const _Tp &b){(a<b)&&(a=b);}
template <typename _Tp>Finline void chmin(_Tp &a,const _Tp &b){(b<a)&&(a=b);}
template <typename _Tp>Finline bool _cmp(const _Tp &a,const _Tp &b){return abs(a-b)<=eps;}
template <typename _Tp>Finline void read(_Tp &x)
{
	register char ch(getchar());
	bool f(false);
	while(ch<48||ch>57) f|=ch==45,ch=getchar();
	x=ch&15,ch=getchar();
	while(ch>=48&&ch<=57) x=(((x<<2)+x)<<1)+(ch&15),ch=getchar();
	if(f) x=-x;
}
template <typename _Tp,typename... Args>Finline void read(_Tp &t,Args &...args)
{
	read(t);read(args...);
}
Finline int read_str(char *s)
{
	register char ch(getchar());
	while(ch==' '||ch=='\r'||ch=='\n') ch=getchar();
	register char *tar=s;
	*tar=ch,ch=getchar();
	while(ch!=' '&&ch!='\r'&&ch!='\n'&&ch!=EOF) *(++tar)=ch,ch=getchar();
	return tar-s+1;
}

const int N=400005;
struct edge{
	int v,nxt;
}c[N<<1];
int front[N],cnt;
Finline void add(int u,int v)
{
	c[++cnt]=(edge){v,front[u]},front[u]=cnt;
}
int f[N][21],dep[N];
void dfs(int x,int fa)
{
	f[x][0]=fa;
	dep[x]=dep[fa]+1;
	for(int i=1;i<=20;++i)
	{
		f[x][i]=f[f[x][i-1]][i-1];
	}
	for(int i=front[x];i;i=c[i].nxt)
	{
		if(c[i].v!=fa)
		{
			dfs(c[i].v,x);
		}
	}
}
int jump(int x,int k)
{
	for(int i=20;i>=0;--i)
	{
		if((k>>i)&1)
		{
			x=f[x][i];
		}
	}
	return x;
}
int lca(int x,int y)
{
	if(dep[x]<dep[y]) std::swap(x,y);
	for(int i=20;i>=0;--i)
	{
		if(dep[f[x][i]]>=dep[y])
		{
			x=f[x][i];
		}
	}
	if(x==y) return x;
	for(int i=20;i>=0;--i)
	{
		if(f[x][i]!=f[y][i])
		{
			x=f[x][i];
			y=f[y][i];
		}
	}
	return f[x][0];
}
int get(int x,int y,int k,int l)
{
	if(dep[x]-dep[l]>=k) return jump(x,k);
	k-=dep[x]-dep[l];
	return jump(y,dep[y]-dep[l]-k);
}
struct node{
	int x,dep;
}_q[N];
int _l,_r;
int fa[N];
int find(int x){return x==fa[x]?x:fa[x]=find(fa[x]);}
int main()
{
	int n,k,r;
	read(n,k,r);
	int node_cnt=n;
	int x,y;
	for(int i=1;i<n;++i)
	{
		++node_cnt;
		read(x,y);
		add(x,node_cnt);
		add(node_cnt,x);
		add(node_cnt,y);
		add(y,node_cnt);
	}
	dfs(1,0);
	_l=1,_r=0;
	for(int i=1;i<=r;++i)
	{
		read(x);
		_q[++_r]=(node){x,0};
		fa[x]=x;
	}
	while(_l!=_r+1)
	{
		node x=_q[_l++];
		if(x.dep>=k) break;
		for(int i=front[x.x];i;i=c[i].nxt)
		{
			if(!fa[c[i].v])
			{
				fa[c[i].v]=fa[x.x];
				_q[++_r]=(node){c[i].v,x.dep+1};
			}
			else
			{
				fa[find(c[i].v)]=find(x.x);
			}
		}
	}
	int _;
	read(_);
	while(_--)
	{
		read(x,y);
		int l=lca(x,y);
		if(dep[x]+dep[y]-(dep[l]<<1)<=(k<<1))
		{
			printf("YES\n");
			continue;
		}
		int a=get(x,y,k,l);
		int b=get(y,x,k,l);
		if(!fa[a]||!fa[b])
		{
			printf("NO\n");
			continue;
		}
		if(find(a)==find(b))
		{
			printf("YES\n");
		}
		else
		{
			printf("NO\n");
		}
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

constexpr int const maxn = 1 << 18;
int pa[maxn][18], dis[maxn], dep[maxn], col[maxn], fa[maxn];
vector<int> adj[maxn];

int find(int u) { return u == fa[u] ? u : fa[u] = find(fa[u]); }

void merge(int u, int v) {
	u = find(u), v = find(v);
	if (u == v) return;
	fa[u] = v;
}

void dfs(int u, int p) {
	dep[u] = dep[p] + 1;
	pa[u][0] = p;
	for (int i = 0; i != 17; ++i) pa[u][i + 1] = pa[pa[u][i]][i];
	for (int v : adj[u]) if (v != p) dfs(v, u);
}

int lca(int u, int v) {
	if (dep[u] < dep[v]) swap(u, v);
	for (int i = 17; ~i; --i) if (dep[pa[u][i]] >= dep[v]) u = pa[u][i];
	if (u == v) return u;
	for (int i = 17; ~i; --i) if (pa[u][i] != pa[v][i]) u = pa[u][i], v = pa[v][i];
	return pa[u][0];
}

int kth(int u, int k) {
	for (int i = 0; i != 18; ++i) if (k >> i & 1) u = pa[u][i];
	return u;
}

int uvkth(int u, int v, int f, int k) {
	return dep[u] - dep[f] < k ? kth(v, dep[u] + dep[v] - dep[f] - dep[f] - k) : kth(u, k);
}

bool check(int u, int v, int k) {
	int f = lca(u, v);
	if (dep[u] + dep[v] - dep[f] - dep[f] <= k) return true;
	int k0 = k >> 1;
	int k1 = k - k0;
	int uu = uvkth(u, v, f, k1);
	int vv = uvkth(v, u, f, k1);
	if (dis[uu] > k0 || dis[vv] > k0) return false;
	return find(col[uu]) == find(col[vv]);
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	memset(dis, -1, maxn << 2);
	iota(fa, fa + maxn, 0);
	int n, k, r;
	cin >> n >> k >> r;
	for (int i = 1; i != n; ++i) {
		int u, v;
		cin >> u >> v;
		adj[u].push_back(v);
		adj[v].push_back(u);
	}
	dfs(1, 0);
	vector<int> bfs(r);
	for (int i = 0; i != r; ++i) {
		cin >> bfs[i];
		dis[bfs[i]] = 0;
		col[bfs[i]] = bfs[i];
	}
	for (int i = 0; i != n; ++i) {
		int u = bfs[i];
		for (int v : adj[u]) {
			if (!~dis[v]) {
				col[v] = col[u];
				dis[v] = dis[u] + 1;
				bfs.push_back(v);
			} else if (dis[u] + dis[v] < k) {
				merge(col[u], col[v]);
			}
		}
	}
	int q;
	cin >> q;
	while (q--) {
		int u, v;
		cin >> u >> v;
		cout << (check(u, v, k) ? "YES\n" : "NO\n");
	}
}


#include<bits/stdc++.h>
using namespace std;
const int N=4e5+10;
typedef vector<int> vi;
#define pb push_back

int gi() {
	int x=0,o=1;char ch=getchar();
	while((ch<'0'||ch>'9')&&ch!='-') ch=getchar();
	if(ch=='-') o=-1,ch=getchar();
	while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar();
	return x*o;
}

int n,k,r,dis[N],fa[N],anc[N][20],dep[N],dsu[N];
vi E[N];

int getf(int x) {
	return x==dsu[x]?x:dsu[x]=getf(dsu[x]);
}

void dfs(int u,int ff) {
	anc[u][0]=ff;dep[u]=dep[ff]+1;
	for(int i=1;i<=18;i++) anc[u][i]=anc[anc[u][i-1]][i-1];
	for(auto v:E[u]) if(v!=ff) dfs(v,u);
}

int lca(int u,int v) {
	if(dep[u]<dep[v]) swap(u,v);
	int c=dep[u]-dep[v];
	for(int i=18;~i;i--) if(c>>i&1) u=anc[u][i];
	if(u==v) return u;
	for(int i=18;~i;i--) if(anc[u][i]!=anc[v][i]) u=anc[u][i],v=anc[v][i];
	return fa[u];
}

int jump(int u,int k) {
	for(int i=18;~i;i--) if(k>>i&1) u=anc[u][i];
	return u;
}

int main() {
	cin>>n>>k>>r;
	for(int i=1,u,v;i<n;i++) u=gi(),v=gi(),E[u].pb(i+n),E[i+n].pb(u),E[v].pb(i+n),E[i+n].pb(v);
	n=n*2-1;memset(dis,0x3f,sizeof(dis));
	for(int i=1;i<=n;i++) dsu[i]=i;
	queue<int> q;
	for(int i=1,u;i<=r;i++) u=gi(),dis[u]=0,q.push(u);
	while(!q.empty()) {
		int u=q.front();q.pop();if(dis[u]==k) continue;
		for(auto v:E[u]) {
			if(dis[v]>dis[u]+1) dis[v]=dis[u]+1,q.push(v);
			dsu[getf(u)]=getf(v);
		}
	}
	dfs(1,0);int T=gi();
	while(T--) {
		int u=gi(),v=gi(),p=lca(u,v),dis=dep[u]+dep[v]-2*dep[lca(u,v)];
		if(dis<=2*k) puts("YES");
		else {
			int x,y;
			if(dep[u]-dep[p]>=k) x=jump(u,k);
			else x=jump(v,dis-k);
			if(dep[v]-dep[p]>=k) y=jump(v,k);
			else y=jump(u,dis-k);
			puts(getf(x)==getf(y)?"YES":"NO");
		}
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
const int N=4e5+10;
typedef vector<int> vi;
#define pb push_back

int gi() {
	int x=0,o=1;char ch=getchar();
	while((ch<'0'||ch>'9')&&ch!='-') ch=getchar();
	if(ch=='-') o=-1,ch=getchar();
	while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar();
	return x*o;
}

int n,k,r,dis[N],fa[N],anc[N][20],dep[N],dsu[N];
vi E[N];

int getf(int x) {
	return x==dsu[x]?x:dsu[x]=getf(dsu[x]);
}

void dfs(int u,int ff) {
	anc[u][0]=fa[u]=ff;dep[u]=dep[ff]+1;
	for(int i=1;i<=18;i++) anc[u][i]=anc[anc[u][i-1]][i-1];
	for(auto v:E[u]) if(v!=ff) dfs(v,u);
}

int lca(int u,int v) {
	if(dep[u]<dep[v]) swap(u,v);
	int c=dep[u]-dep[v];
	for(int i=18;~i;i--) if(c>>i&1) u=anc[u][i];
	if(u==v) return u;
	for(int i=18;~i;i--) if(anc[u][i]!=anc[v][i]) u=anc[u][i],v=anc[v][i];
	return fa[u];
}

int jump(int u,int k) {
	for(int i=18;~i;i--) if(k>>i&1) u=anc[u][i];
	return u;
}

int main() {
	cin>>n>>k>>r;
	for(int i=1,u,v;i<n;i++) u=gi(),v=gi(),E[u].pb(i+n),E[i+n].pb(u),E[v].pb(i+n),E[i+n].pb(v);
	n=n*2-1;memset(dis,0x3f,sizeof(dis));
	for(int i=1;i<=n;i++) dsu[i]=i;
	queue<int> q;
	for(int i=1,u;i<=r;i++) u=gi(),dis[u]=0,q.push(u);
	while(!q.empty()) {
		int u=q.front();q.pop();if(dis[u]==k) continue;
		for(auto v:E[u]) {
			if(dis[v]>dis[u]+1) dis[v]=dis[u]+1,q.push(v);
			dsu[getf(u)]=getf(v);
		}
	}
	dfs(1,0);int T=gi();
	while(T--) {
		int u=gi(),v=gi(),p=lca(u,v),dis=dep[u]+dep[v]-2*dep[p];
		if(dis<=2*k) puts("YES");
		else {
			if(dep[u]-dep[p]>=k) u=jump(u,k);
			else u=jump(v,dis-k);
			p=lca(u,v);dis=dep[u]+dep[v]-2*dep[p];
			if(dep[v]-dep[p]>=k) v=jump(v,k);
			else v=jump(u,dis-k);
			puts(getf(u)==getf(v)?"YES":"NO");
		}
	}
	return 0;
}


#include<bits/stdc++.h>
#define del(a,i) memset(a,i,sizeof(a))
#define ll long long
#define inl inline
#define il inl void
#define it inl int
#define ill inl ll
#define re register
#define ri re int
#define rl re ll
#define mid ((l+r)>>1)
#define lowbit(x) (x&(-x))
#define INF 0x3f3f3f3f
using namespace std;
template<class T>il read(T &x){
	int f=1;char k=getchar();x=0;
	for(;k>'9'||k<'0';k=getchar()) if(k=='-') f=-1;
	for(;k>='0'&&k<='9';k=getchar()) x=x*10+k-'0';
	x*=f;
}
template<class T>il _print(T x){
	if(x>=10) _print(x/10);
	putchar(x%10+'0');
}
template<class T>il print(T x){
	if(x<0) putchar('-'),x=-x;
	_print(x);
}
ll mul(ll a,ll b,ll mod){long double c=1.;return (a*b-(ll)(c*a*b/mod)*mod)%mod;}
it qpow(int x,int k,int mod){
	int res=1,bas=x;
	while(k){
		if(k&1) res=1ll*res*bas%mod;
		bas=1ll*bas*bas%mod,k>>=1;
	}
	return res;
}
const int N = 4e5+5;
int n,k,m,Q,u,v,fa[N],vis[N],dep[N],f[N][21];
vector<int> G[N];
il add_edge(int u,int v){
	G[u].push_back(v);
	G[v].push_back(u);
}
il DFS(int u,int fa){
	f[u][0]=fa,dep[u]=dep[fa]+1;
	for(ri i=1;i<=20;++i) f[u][i]=f[f[u][i-1]][i-1];
	for(auto v:G[u]){
		if(v==fa) continue;
		DFS(v,u);
	}
}
it find(int x){return x==fa[x]?x:fa[x]=find(fa[x]);}
it LCA(int u,int v){
	if(dep[u]<dep[v]) swap(u,v);
	for(ri i=20;i>=0;--i) if(dep[f[u][i]]>=dep[v]) u=f[u][i];
	if(u==v) return u;
	for(ri i=20;i>=0;--i) if(f[u][i]^f[v][i]) u=f[u][i],v=f[v][i];
	return f[u][0];
}
it go(int u,int k){
	for(ri i=20;i>=0;--i) if(k&(1<<i)) u=f[u][i];
	return u;
}
int main(){
//	freopen(".in","r",stdin);
//	freopen(".out","w",stdout);
	read(n),read(k),read(m);
	int t=n;
	for(ri i=1;i<t;++i){
		read(u),read(v);
		add_edge(u,++n);
		add_edge(v,n);
	}
	DFS(1,0),del(vis,-1);
	queue<int> q;
	for(ri i=1;i<=n;++i) fa[i]=i;
	for(ri i=1;i<=m;++i) read(u),vis[u]=0,q.push(u);
	while(!q.empty()){
		int pos=q.front();q.pop();
		if(vis[pos]==k) continue;
		for(auto v:G[pos]){
			int x=find(pos),y=find(v);
			fa[x]=y;
			if(vis[v]==-1){
				vis[v]=vis[pos]+1;
				q.push(v);
			}
		}
	}
	read(Q);
	for(ri i=1;i<=Q;++i){
		read(u),read(v);
		int lca=LCA(u,v);
		int dist=dep[u]+dep[v]-2*dep[lca];
		if(dist<=2*k){puts("YES");continue;}
		int t1=k<=dep[u]-dep[lca]?find(go(u,k)):find(go(v,dist-k));
		int t2=k<=dep[v]-dep[lca]?find(go(v,k)):find(go(u,dist-k));
		puts(t1==t2?"YES":"NO");
	}
	return 0;
}


import java.util.*;

public class Solution {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int t = sc.nextInt();
    while (t-- > 0) {
      int n = sc.nextInt(), d = sc.nextInt();
      int[] a = new int[n];
      for (int i = 0; i < n; i++) {
        a[i] = sc.nextInt();
      }
      for (int i = 1; i < n; i++) {
        int move = Math.min(a[i], d / i);
        a[0] += move;
        d -= move * i;
      }
      System.out.println(a[0]);
    }
  }
}


import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.InputMismatchException;

public class A {
	//author: Nagabhushan S Baddi

	private static int n;
	private static int[] a;
	private static int d;
	private static String s;
	private static HashMap<Integer, ArrayList<Integer>> g;

	public static void main(String[] args) {
		int t = ini();
		while (t-- > 0) {
			n = ini();
			d = ini();
			a = ina(n);

			long ans = a[0];
			long days = 0;
			for(int i=1; i<n; i++) {
				if (days+a[i]*i<=d) {
					ans += a[i];
					days += a[i]*i;
				} else {
					ans += (d-days)/i;
					break;
				}
			}
			pd(ans);
		}

		//ans+k*i=d => k = d-ans

		out.flush();
		out.close();

	}

	//CONSTANTS
	private static final int MOD = (int) 1e9 + 7;

	//NONPROBLEM CODE

	private static InputReader in = new InputReader(System.in);
	private static PrintWriter out = new PrintWriter(System.out);

	private static class InputReader {

		private final InputStream stream;
		private final byte[] buf = new byte[8192];
		private int curChar, snumChars;

		public InputReader(InputStream st) {
			this.stream = st;
		}

		public int read() {
			if (snumChars == -1)
				throw new InputMismatchException();
			if (curChar >= snumChars) {
				curChar = 0;
				try {
					snumChars = stream.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (snumChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}

		public int nextInt() {
			int c = read();
			while (isSpaceChar(c)) {
				c = read();
			}
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			int res = 0;
			do {
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public long nextLong() {
			int c = read();
			while (isSpaceChar(c)) {
				c = read();
			}
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			long res = 0;
			do {
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public String readString() {
			int c = read();
			while (isSpaceChar(c)) {
				c = read();
			}
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		public String nextLine() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isEndOfLine(c));
			return res.toString();
		}

		public boolean isSpaceChar(int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		private boolean isEndOfLine(int c) {
			return c == '\n' || c == '\r' || c == -1;
		}

	}

	//SORT SHORTCUTS

	private static void sort(int[] a) {
		int n = a.length;
		Integer[] b = new Integer[n];
		for (int i = 0; i < n; i++) {
			b[i] = a[i];
		}

		Arrays.sort(b);

		for (int i = 0; i < n; i++) {
			a[i] = b[i];
		}
	}

	private static void sort(long[] a) {
		int n = a.length;
		long[] b = new long[n];
		for (int i = 0; i < n; i++) {
			b[i] = a[i];
		}

		Arrays.sort(b);

		for (int i = 0; i < n; i++) {
			a[i] = b[i];
		}
	}

	//INPUT SHORTCUTS

	private static int[] ina(int n) {
		int[] temp = new int[n];
		for (int i = 0; i < n; i++) {
			temp[i] = in.nextInt();
		}
		return temp;
	}

	private static int ini() {
		return in.nextInt();
	}

	private static long inl() {
		return in.nextLong();
	}

	private static String ins() {
		return in.readString();
	}

	//PRINT SHORTCUTS

	private static void println(Object... o) {
		for (Object x : o) {
			out.write(x + "");
		}
		out.write("\n");
	}

	private static void pd(Object... o) {
		for (Object x : o) {
			out.write(x + "");
		}
		out.flush();
		out.write("\n");
	}

	private static void print(Object... o) {
		for (Object x : o) {
			out.write(x + "");
		}
	}

	//GRAPH SHORTCUTS

	private static HashMap<Integer, ArrayList<Integer>> intree(int n) {

		HashMap<Integer, ArrayList<Integer>> g = new HashMap<>();
		for (int i = 0; i < n; i++) {
			g.put(i, new ArrayList<>());
		}

		for (int i = 0; i < n - 1; i++) {
			int u = ini() - 1;
			int v = ini() - 1;
			g.get(u).add(v);
			g.get(v).add(u);
		}

		return g;
	}

	private static HashMap<Integer, ArrayList<Integer>> ingraph(int n, int m) {
		HashMap<Integer, ArrayList<Integer>> g = new HashMap<>();

		for (int i = 0; i < n; i++) {
			g.put(i, new ArrayList<>());
		}

		for (int i = 0; i < m; i++) {
			int u = ini() - 1;
			int v = ini() - 1;
			g.get(u).add(v);
			g.get(v).add(u);
		}

		return g;

	}

	private static HashMap<Integer, ArrayList<Edge>> inweightedgraph(int n, int m) {
		HashMap<Integer, ArrayList<Edge>> g = new HashMap<>();

		for (int i = 0; i < n; i++) {
			g.put(i, new ArrayList<>());
		}

		for (int i = 0; i < m; i++) {
			int u = ini() - 1;
			int v = ini() - 1;
			int w = ini();
			Edge edge = new Edge(u, v, w);
			g.get(u).add(edge);
			g.get(v).add(edge);
		}

		return g;

	}

	private static class Edge implements Comparable<Edge> {
		private int u, v;
		private long w;

		public Edge(int a, int b, long c) {
			u = a;
			v = b;
			w = c;
		}

		public int other(int x) {
			return (x == u ? v : u);
		}

		public int compareTo(Edge edge) {
			return Long.compare(w, edge.w);
		}
	}

	private static class Pair {
		private int u, v;

		public Pair(int a, int b) {
			u = a;
			v = b;
		}

		public int hashCode() {
			return u + v + u * v;
		}

		public boolean equals(Object object) {
			Pair pair = (Pair) object;
			return u == pair.u && v == pair.v;
		}
	}

	private static class Node implements Comparable<Node> {
		private int u;
		private long dist;

		public Node(int a, long b) {
			u = a;
			dist = b;
		}

		public int compareTo(Node node) {
			return Long.compare(dist, node.dist);
		}
	}

	//MATHS AND NUMBER THEORY SHORTCUTS

	private static int gcd(int a, int b) {
		//O(log(min(a,b)))
		if (b == 0)
			return a;

		return gcd(b, a % b);
	}

	private static long modExp(long a, long b) {
		if (b == 0)
			return 1;

		a %= MOD;

		long exp = modExp(a, b / 2);

		if (b % 2 == 0) {
			return (exp * exp) % MOD;
		} else {
			return (a * ((exp * exp) % MOD)) % MOD;
		}
	}
}