/*
* Copyright (c) 2024 Emon Thakur
* All rights reserved.
*/
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define MOD 1000000007
#define pie 2*(acos(0.0))
#define yes cout<<"YES\n"
#define no cout<<"NO\n"
#define pb push_back
#define endl '\n'
#define lcm(a,b) (a*b)/(__gcd<ll>(a,b))
#define print(v) for(auto e:v) cout<<e<<" "; cout<<endl;
#define printp(v) for(auto e:v) cout<<e.first<<" "<<e.second<<endl;
#define srt(v) sort(v.begin(),v.end())
#define rsrt(v) sort(v.rbegin(),v.rend())
#define life_is_a_race ios::sync_with_stdio(false); cin.tie(nullptr);
vector<int> g[100005];
int first[100005],last[100005],ind=0;
vector<vector<int>> sg(800010,vector<int>(26));
vector<int> vis;
char s[100005];
void eulertour(int node,int par)
{
first[node]=ind;
vis.push_back(node);
++ind;
for(auto e:g[node])
{
if(e == par) continue;
eulertour(e,node);
}
last[node]=ind;
vis.push_back(node);
++ind;
}
void buildsg(int node,int start,int end)
{
if(start == end)
{
if(first[vis[start]] == start) sg[node][s[vis[start]]-'a']++;
return;
}
int mid = (start+end)/2;
buildsg(node*2,start,mid);
buildsg(node*2+1,mid+1,end);
for(int i=0;i<26;i++) sg[node][i] = sg[node*2][i]+sg[node*2+1][i];
}
void update(int node,int start,int end,int ind,int i,int j)
{
if(start == end)
{
sg[node][i] ++;
sg[node][j] --;
return;
}
int mid = (start+end)/2;
if(ind<=mid) update(node*2,start,mid,ind,i,j);
else update(node*2+1,mid+1,end,ind,i,j);
for(int k=0;k<26;k++) sg[node][k] = sg[node*2][k]+sg[node*2+1][k];
}
vector<int> query(int node,int start,int end,int l,int r)
{
if(l>end || r<start)
{
vector<int>v(26,0);
return v;
}
if(l<=start && r>=end) return sg[node];
int mid = (start+end)/2;
vector<int> a = query(node*2,start,mid,l,r);
vector<int> b = query(node*2+1,mid+1,end,l,r);
for(int i=0;i<26;i++) a[i] += b[i];
return a;
}
void solve(int tc)
{
//cout<<"Case "<<tc<<": ";
int n,u,v; cin >> n;
for(int i=1;i<=n;i++) cin >> s[i];
for(int i=0;i<n-1;i++)
{
cin >> u >> v;
g[u].push_back(v);
g[v].push_back(u);
}
eulertour(1,0);
int m = vis.size();
buildsg(1,0,m-1);
int type,node,q,cnt;
char c;
cin >> q; while(q--)
{
cin >> type;
if(type==1)
{
cin >> node >> c;
update(1,0,m-1,first[node],c-'a',s[node]-'a');
s[node] = c;
}
else
{
cin >> node;
vector<int> v = query(1,0,m-1,first[node],last[node]-1);
c = 'z'; cnt = 0;
for(int i=25;i>=0;i--)
{
if(v[i]>=cnt)
{
cnt = v[i];
c = 'a'+i;
}
}
cout << c << endl;
}
}
}
int main()
{
life_is_a_race
int t=1;
//cin>>t;
for(int i=1;i<=t;i++) solve(i);
}