/*
* Copyright (c) 2024 Emon Thakur
* All rights reserved.
*/
#include<bits/stdc++.h>
using namespace std;
vector<int> g[100005];
#define READ(f) freopen(f, "r", stdin)
#define WRITE(f) freopen(f, "w", stdout)
int dp[100005][26];
string s;
int parent[100005];
void dpontree(int node,int par)
{
dp[node][s[node-1]-'a']++;
parent[node] = par;
for(auto e:g[node])
{
if(e == par) continue;
dpontree(e,node);
}
for(auto e:g[node])
{
if(e == par) continue;
for(int i=0;i<26;i++) dp[node][i] += dp[e][i];
}
}
int main()
{
// READ("input12.txt");
// WRITE("output12.txt") ;
int n; cin >> n;
char cc;
for(int i=0;i<n;i++)
{
cin >> cc;
s.push_back(cc);
}
for(int i=0;i<n-1;i++)
{
int u,v; cin >> u >> v;
g[u].push_back(v);
g[v].push_back(u);
}
dpontree(1,0);
//for(int i=1;i<=n;i++) cout<<i<<" "<<parent[i]<<endl; cout<<endl;
int q; cin >> q;
while(q--)
{
int type,x,nd,cnt=0,ind;
char c,prevc;
cin >> type;
if(type==1)
{
cin >> nd >> c;
prevc = s[nd-1];
s[nd-1] = c;
while(nd != 0)
{
dp[nd][prevc-'a']--;
dp[nd][c-'a']++;
nd = parent[nd];
}
continue;
}
cin >> x;
for(int i=25;i>=0;i--)
{
if(cnt <= dp[x][i])
{
cnt = dp[x][i];
ind = i;
}
}
cout << (char) ('a' + ind) <<endl;
}
}