#include <bits/stdc++.h>
using namespace std;
int main()
{
int N, M;
cin >> N >> M;
string S;
cin >> S;
vector<pair<int, int>> actions;
for (int i = 0; i < M; i++)
{
char typ;
cin >> typ;
if (typ == 'a')
{
int a, b;
cin >> a >> b;
a--, b--;
actions.push_back({a, b});
}
else
{
int x;
cin >> x;
x--;
for (int j = actions.size() - 1; j >= 0; j--)
{
if (x == actions[j].second)
x = actions[j].first;
else if (actions[j].second > actions[j].first && x >= actions[j].first && x < actions[j].second)
x++;
else if (actions[j].second < actions[j].first && x <= actions[j].first && x > actions[j].second)
x--;
}
cout << S[x] << '\n';
}
}
}