//Utkarsh.25dec
#include <bits/stdc++.h>
#define ll long long int
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define vl vector <ll>
#define all(c) (c).begin(),(c).end()
using namespace std;
ll power(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll modInverse(ll a){return power(a,mod-2);}
const int N=500023;
bool vis[N];
vector <int> adj[N];
long long readInt(long long l,long long r,char endd){
long long x=0;
int cnt=0;
int fi=-1;
bool is_neg=false;
while(true){
char g=getchar();
if(g=='-'){
assert(fi==-1);
is_neg=true;
continue;
}
if('0'<=g && g<='9'){
x*=10;
x+=g-'0';
if(cnt==0){
fi=g-'0';
}
cnt++;
assert(fi!=0 || cnt==1);
assert(fi!=0 || is_neg==false);
assert(!(cnt>19 || ( cnt==19 && fi>1) ));
} else if(g==endd){
if(is_neg){
x= -x;
}
if(!(l <= x && x <= r))
{
cerr << l << ' ' << r << ' ' << x << '\n';
assert(1 == 0);
}
return x;
} else {
assert(false);
}
}
}
string readString(int l,int r,char endd){
string ret="";
int cnt=0;
while(true){
char g=getchar();
assert(g!=-1);
if(g==endd){
break;
}
cnt++;
ret+=g;
}
assert(l<=cnt && cnt<=r);
return ret;
}
long long readIntSp(long long l,long long r){
return readInt(l,r,' ');
}
long long readIntLn(long long l,long long r){
return readInt(l,r,'\n');
}
string readStringLn(int l,int r){
return readString(l,r,'\n');
}
string readStringSp(int l,int r){
return readString(l,r,' ');
}
int dp[N][20];
const int k=20;
int up[N][k];
int tin[N],tout[N];
int timer=1;
void dfs(int curr,int par)
{
vis[curr]=1;
tin[curr]=timer++;
up[curr][0]=par;
for(int i=1;i<k;i++)
{
up[curr][i]=up[up[curr][i-1]][i-1];
}
for(auto it:adj[curr])
{
if(it==par)
continue;
dfs(it,curr);
}
tout[curr]=timer++;
}
bool is_ancestor(int u, int v)
{
return tin[u] <= tin[v] && tout[u] >= tout[v];
}
int lca(int u, int v)
{
if (is_ancestor(u, v))
return u;
if (is_ancestor(v, u))
return v;
for (int i = k-1; i >= 0; --i)
{
if(is_ancestor(up[u][i], v))
continue;
else
u=up[u][i];
}
return up[u][0];
}
int sumN=0,sumQ=0;
void solve()
{
int n=readInt(1,200000,'\n');
sumN+=n;
assert(sumN<=200000);
string s=readString(n,n,'\n');
s='$'+s;
timer=1;
for(int i=1;i<=n;i++)
{
adj[i].clear();
vis[i]=0;
for(int j=0;j<20;j++)
dp[i][j]=0;
}
for(int i=1;i<n;i++)
{
int x,y;
x=readInt(1,n,' ');
y=readInt(1,n,'\n');
adj[x].pb(y);
adj[y].pb(x);
assert(x!=y);
}
dfs(1,1);
for(int i=1;i<=n;i++)
assert(vis[i]!=0);
for(int i=1;i<=n;i++)
dp[i][0]=(1<<(s[i]-'a'));
for(int i=1;i<20;i++)
{
for(int curr=1;curr<=n;curr++)
dp[curr][i]=(dp[curr][i-1]|dp[up[curr][i-1]][i-1]);
}
int q=readInt(1,200000,'\n');
sumQ+=q;
assert(sumQ<=200000);
while(q--)
{
int u,v;
u=readInt(1,n,' ');
v=readInt(1,n,'\n');
assert(u!=v);
int valu=0,valv=0;
int tmpu=u,tmpv=v;
if(is_ancestor(u,v) || is_ancestor(v,u))
{
cout<<"NO\n";
continue;
}
for(int i=k-1;i>=0;i--)
{
if(is_ancestor(up[tmpu][i], tmpv))
continue;
else
{
valu|=dp[tmpu][i];
tmpu=up[tmpu][i];
}
}
valu|=dp[tmpu][0];
tmpu=u,tmpv=v;
for(int i=k-1;i>=0;i--)
{
if(is_ancestor(up[tmpv][i], tmpu))
continue;
else
{
valv|=dp[tmpv][i];
tmpv=up[tmpv][i];
}
}
valv|=dp[tmpv][0];
if((valu&valv)!=0)
cout<<"YES\n";
else
cout<<"NO\n";
}
}
int main()
{
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
ios_base::sync_with_stdio(false);
cin.tie(NULL),cout.tie(NULL);
int T=readInt(1,200000,'\n');
//cin>>T;
while(T--)
solve();
assert(getchar()==-1);
cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
}