#include <bits/stdc++.h>
using namespace std;
int main()
{
int n, q;
cin >> n >> q;
string s;
cin >> s;
vector<pair<int, char>> st;
for(int i = n - 1; i >= 0; i--)
{
st.push_back({i, s[i]});
}
for(int j = 0; j < q; j++)
{
int t;
cin >> t;
if(t == 1)
{
int i;
char x;
cin >> i >> x;
i--;
while(!st.empty() && st.back().first <= i)
{
st.pop_back();
}
st.push_back({i, x});
}
else
{
int i;
cin >> i;
i--;
int l = 0, r = st.size();
while(r - l > 1)
{
int m = (l + r) / 2;
if(st[m].first >= i)
l = m;
else
r = m;
}
cout << st[l].second << "\n";
}
}
return 0;
}