#include<bits/stdc++.h>
using namespace std;
const long long M=1e5+10,MOD=1000000000;
typedef long long ll;
#define READ(f) freopen(f, "r", stdin)
#define WRITE(f) freopen(f, "w", stdout)
int level[M];
vector<int>edge[M];
int cnt=1;
int in[M],out[M];
int bit[26][M];
int query(int id,int c){
int sum=0;
while(id>0){
sum+=bit[c][id];
id-=id & (-id);
}
return sum;
}
void update(int id,int n,int val,int c){
while(id<=n){
bit[c][id]+=val;
id+=id & (-id);
}
}
void dfs(int x,int p){
in[x]=cnt;
cnt++;
for(auto u:edge[x]){
if(u!=p){
dfs(u,x);
}
}
out[x]=cnt-1;
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
// READ("input8.txt");
// WRITE("output12.txt") ;
int t=1;
//cin>>t;
while(t--){
int n;
cin>>n;
vector<char>s(n);
for(int i=0;i<n;i++)cin>>s[i];
for(int i=1;i<n;i++){
int x,y;
cin>>x>>y;
edge[x].push_back(y);
edge[y].push_back(x);
}
dfs(1,0);
for(char ch='a';ch<='z';ch++){
for(int j=1;j<=n;j++){
if(s[j-1]==ch){
update(in[j],n,1,ch-'a');
}
}
}
int q;
cin>>q;
while(q--){
int type;
cin>>type;
if(type==1){
int x;
char ch;
cin>>x>>ch;
if(ch==s[x-1])continue;
update(in[x],n,-1,s[x-1]-'a');
s[x-1]=ch;
update(in[x],n,1,s[x-1]-'a');
}
else{
int x;
cin>>x;
int mx=-1;
char ans='a';
for(char ch='a';ch<='z';ch++){
int sumoffre=query(out[x],ch-'a')-query(in[x]-1,ch-'a');
if(sumoffre>mx){
mx=sumoffre;
ans=ch;
}
}
cout<<ans<<"\n";
}
}
// for(int i=1;i<=n;i++)edge[i].clear();
}
return 0;
}