#include <bits/stdc++.h>
#ifdef LOCAL
#include "template.cpp.h"
#else
#define debug(...)
#endif
#define int long long
using namespace std;
#define cinv(v) for (auto &it:v) cin>>it;
#define coutv(v) for (auto &it:v) cout<< it<<' '; cout<<'\n';
const int N = 1e5 + 5;
vector<int> adj[N];
int n, q, tin[N], tout[N], timer = 0;
array<int, 26> tree[4 * N];
char arr[N];
array<int, 26> merge(array<int, 26> &a, array<int, 26> &b) {
array<int, 26> ret = a;
for (int i = 0; i < 26; ++i) ret[i] += b[i];
return ret;
}
void update(int node, int start, int end, int idx, int c, int val) {
if (start > idx || end < idx) return;
if (start == end) {
tree[node][c] += val;
return;
}
int mid = (start + end) / 2;
update(node * 2, start, mid, idx, c, val);
update(node * 2 + 1, mid + 1, end, idx, c, val);
tree[node] = merge(tree[node * 2], tree[node * 2 + 1]);
}
array<int, 26> query(int node, int start, int end, int l, int r) {
if (start > r || end < l) return array<int, 26>{};
if (start >= l && end <= r) return tree[node];
int mid = (start + end) / 2;
array<int, 26> q1 = query(node * 2, start, mid, l, r);
array<int, 26> q2 = query(node * 2 + 1, mid + 1, end, l, r);
return merge(q1, q2);
}
void euler_tour(int now, int par) {
tin[now] = ++timer;
for (auto &it: adj[now]) {
if (it == par) continue;
euler_tour(it, now);
}
tout[now] = timer;
}
void shelby() {
cin >> n;
for (int i = 1; i <= n; ++i) cin >> arr[i];
for (int i = 1; i < n; ++i) {
int u, v;
cin >> u >> v;
adj[u].push_back(v);
adj[v].push_back(u);
}
euler_tour(1, -1);
for (int i = 1; i <= n; ++i) update(1, 1, n, tin[i], arr[i] - 'a', 1);
cin >> q;
while (q--) {
int t, k;
cin >> t >> k;
if (t == 1) {
char c;
cin >> c;
update(1, 1, n, tin[k], arr[k] - 'a', -1);
arr[k] = c;
update(1, 1, n, tin[k], arr[k] - 'a', 1);
}
else {
array<int, 26> get = query(1, 1, n, tin[k], tout[k]);
int ans = -1, mx = 0;
for (int i = 0; i < 26; ++i) {
if (get[i] > mx) ans = i, mx = get[i];
}
debug(ans, k, tin[k], tout[k], get);
cout << char(ans + 'a') << '\n';
}
}
}
signed main() {
cin.tie(0)->ios_base::sync_with_stdio(0);
int t = 1;
// cin >> t;
for (int _ = 1; _ <= t; ++_) {
// cout << "Case " << _ << ": ";
shelby();
}
}