/**
* Author: AhSaN (JUST-22)
* Created: 05-09-2024 23:33:13
**/
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
const int N = 1e5 + 2;
struct ST {
int n;
vector<array<int, 26>> tree;
ST(int size) : n(size) {
tree.resize(4 * n);
}
void merge(int node) {
for (int i = 0; i < 26; i++) {
tree[node][i] = tree[node << 1][i] + tree[node << 1 | 1][i];
}
}
void build(string &s, int node, int start, int end) {
if (start == end) {
tree[node].fill(0);
tree[node][s[end] - 'a'] += 1;
} else {
int mid = (start + end) >> 1;
build(s, node << 1, start, mid);
build(s, node << 1 | 1, mid + 1, end);
merge(node);
}
}
void update (int node, int start, int end, int id, int old, int newchar) {
if (start == end) {
tree[node][old - 'a'] -= 1;
tree[node][newchar - 'a'] += 1;
} else {
int mid = (start + end) >> 1;
if (id <= mid) update(node << 1, start, mid, id, old, newchar);
else update(node << 1 | 1, mid + 1, end, id, old, newchar);
merge(node);
}
}
array<int, 26> Qry(int node, int start, int end, int l, int r) {
if (l > r) return array<int, 26>{};
if (start == l && end == r) {
return tree[node];
}
int mid = (start + end) >> 1;
auto left = Qry(node << 1, start, mid, l, min(r, mid));
auto right = Qry(node << 1 | 1, mid + 1, end, max(l, mid + 1), r);
array<int, 26> res {};
for (int i = 0; i < 26; i++) res[i] = left[i] + right[i];
return res;
}
char get(int l, int r) {
auto f = Qry(1, 0, n - 1, l, r);
int id = max_element(f.begin(), f.end()) - f.begin();
return char('a' + id);
}
};
void Sol(int Cs) {
int n;
cin >> n;
string s;
for (int i = 0; i < n; i++) {
char c;
cin >> c;
s += c;
}
vector<vector<int>> g(n);
for (int i = 0, u, v; i < n - 1; i++) {
cin >> u >> v, --u, --v;
g[u].push_back(v), g[v].push_back(u);
}
vector<int> start(n, 0), end(n, 0);
int timer = 0;
auto dfs = [&](auto &&gorib, int node, int par) -> void {
start[node] = timer++;
for (auto &son : g[node]) {
if (son != par) {
gorib(gorib, son, node);
}
}
end[node] = timer - 1;
};
dfs(dfs, 0, -1);
ST st(n);
st.build(s, 1, 0, n - 1);
int Q;
cin >> Q;
while (Q--) {
int t;
cin >> t;
if (t == 1) {
int id;
char c;
cin >> id >> c, --id;
id = start[id];
st.update(1, 0, n - 1, id, s[id], c);
s[id] = c;
} else {
int node;
cin >> node;
--node;
cout << st.get(start[node], end[node]) << "\n";
}
}
}
signed main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int Tc = 1;
// cin >> Tc;
for (int Cs = 1; Cs <= Tc; Cs++) {
Sol(Cs);
}
return 0;
}