#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long 
#define pb(e) push_back(e)
#define sv(a) sort(a.begin(),a.end())
#define sa(a,n) sort(a,a+n)
#define mp(a,b) make_pair(a,b)
#define vf first
#define vs second
#define ar array
#define all(x) x.begin(),x.end()
const int inf = 0x3f3f3f3f;
const int mod = 1000000007; 
const double PI=3.14159265358979323846264338327950288419716939937510582097494459230;
bool remender(ll a , ll b){return a%b;}
 
//freopen("problemname.in", "r", stdin);
//freopen("problemname.out", "w", stdout);
 
const int N = 200003 , L = 23;
 
vector<int> adj[N];
int tin[N] , tout[N] , tim , up[N][L];
string s;
int pre[N][30];
 
void dfs(int node , int par){
	tin[node] = ++tim;
	up[node][0] = par;
	for(int i = 1; i < L; i++){
		up[node][i] = up[up[node][i-1]][i-1];
	}
	for(int i = 0; i < 26; i++)pre[node][i] = pre[par][i];
	pre[node][s[node - 1]-'a']++;
	for(auto i : adj[node]){
		if(i != par)dfs(i , node);
	}
	tout[node] = ++tim;
}
 
bool islca(int x , int y){
	return tin[x] <= tin[y] && tout[x] >= tout[y];
}
 
int findlca(int x , int y){
	if(islca(x,y))return x;
	if(islca(y , x))return y;
	for(int i = L-1; i >= 0; i--){
		if(!islca(up[x][i] , y)){
			x = up[x][i];
		}
	}
	return up[x][0];
}
 
void solve(){
	int n;
	cin >> n;
	cin >> s;
	for(int i = 0; i < n -1; i++){
		int u , v;
		cin >> u >> v;
		adj[u].pb(v);
		adj[v].pb(u);
	}
	tim = 0;
	for(int i = 0; i <= n; i++){
		for(int j = 0; j <= 26; j++)pre[i][j] = 0;
	}
	dfs(1 , 1);
	int q;
	cin >> q;
	while(q--){
		int u , v;
		cin >> u >> v;
		int lca = findlca(u , v);
		string ans = "NO";
		for(int i = 0; i < 26; i++){
			int x = pre[u][i] - pre[lca][i] , y = pre[v][i] - pre[lca][i];
			if(x > 0 && y > 0){
				ans = "YES";
			}
		}
		cout << ans << '\n';
	}
	for(int i = 0; i <= n; i++)adj[i].clear();
}
 
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
	int t;cin >> t;while(t--)
	solve();
	return 0;
}