#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAXN = 2e5 + 5;
const ll BASE = 31, MOD = 1e9 + 7;
int num(char c){ return c - 'a' + 1; }
typedef struct nd{
ll hashn, hashr;
int cnt, pr, rev;
ll val;
nd *l, *r;
nd(char c) : hashn(num(c)), hashr(num(c)), cnt(1), pr(rand()), rev(0), val(num(c)), l(0), r(0){}
} *node;
node root;
char str[MAXN];
ll powers[MAXN];
int N, M;
int cnt(node t){ return t ? t->cnt : 0; }
ll nhash(node t){ return t ? t->hashn : 0; }
ll rhash(node t){ return t ? t->hashr : 0; }
int rev(node t){ return t ? t->rev : 0; }
int val(node t){ return t ? t->val : 0; }
ll mod(ll x){ return x % MOD; }
void upd(node &t){
if(t){
if(t->rev){
swap(t->l, t->r);
swap(t->hashn, t->hashr);
if(t->l){
t->l->rev ^= 1;
}
if(t->r){
t->r->rev ^= 1;
}
t->rev = 0;
}
}
}
void operation(node &t)
{
if(!t) return;
upd(t->l);
upd(t->r);
t->cnt = cnt(t->l) + cnt(t->r) + 1;
t->hashn = mod(mod(nhash(t->l) + mod(powers[cnt(t->l)] * val(t))) + mod(powers[cnt(t->l) + 1] * nhash(t->r)));
t->hashr = mod(mod(rhash(t->r) + mod(powers[cnt(t->r)] * val(t))) + mod(powers[cnt(t->r) + 1] * rhash(t->l)));
}
void split(node t, node &l, node &r, int key){
upd(t);
if(!t){ l = r = 0; return; }
if(cnt(t->l) + 1 <= key){ split(t->r, t->r, r, key - cnt(t->l) - 1); l = t; }
else{ split(t->l, l, t->l, key); r = t; }
operation(l); operation(r);
}
void merge(node &t, node l, node r){
upd(l); upd(r);
if(!l || !r){ t = l ? l : r; return; }
if(l->pr > r->pr){ merge(l->r, l->r, r); t = l; }
else{ merge(r->l, l, r->l); t = r; }
operation(t);
}
bool check(node t, int l, int r){
node t1, t2, t3;
split(t, t1, t2, r);
split(t1, t3, t1, l - 1);
bool res = (t1->hashn == t1->hashr);
merge(t1, t3, t1);
merge(t, t1, t2);
return res;
}
void add(node &t, node x, int pos){
node t1, t2;
split(t, t1, t2, pos - 1);
merge(t1, t1, x);
merge(t, t1, t2);
}
void reverse(node &t, int l, int r){
node t1, t2, t3;
split(t, t1, t2, r);
split(t1, t3, t1, l - 1);
t1->rev ^= 1;
merge(t1, t3, t1);
merge(t, t1, t2);
}
void cut(node &t, int i, int j, int k){
node t1, t2, t3, t4, t5;
split(t, t1, t3, j);
split(t1, t1, t2, i - 1);
merge(t1, t1, t3);
split(t1, t4, t5, k);
merge(t4, t4, t2);
merge(t, t4, t5);
}
int main(){
scanf("%d %d %s", &N, &M, str);
powers[0] = 1;
for(int i=1; i<MAXN; ++i) powers[i] = mod(powers[i - 1] * BASE);
for(int i=0; i<N; ++i) merge(root, root, new nd(str[i]));
while(M--){
char s[3], q[3];
int x, y, z, k;
scanf("%s %d %d", s, &x, &y);
if(s[0] == 'Q') puts(check(root, x, y) ? "YES" : "NO");
else if(x == 1){
scanf("%d %d", &z, &k); cut(root, y, z, k);
}
else if(x == 2){
scanf("%d", &z); reverse(root, y, z);
}
else{
scanf("%s", q); add(root, new nd(q[0]), y);
}
}
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+Cgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKdHlwZWRlZiBsb25nIGxvbmcgbGw7CmNvbnN0IGludCBNQVhOID0gMmU1ICsgNTsKY29uc3QgbGwgQkFTRSA9IDMxLCBNT0QgPSAxZTkgKyA3OwoKaW50IG51bShjaGFyIGMpeyByZXR1cm4gYyAtICdhJyArIDE7IH0KCnR5cGVkZWYgc3RydWN0IG5kewoJbGwgaGFzaG4sIGhhc2hyOwoJaW50IGNudCwgcHIsIHJldjsKCWxsIHZhbDsKCW5kICpsLCAqcjsKCW5kKGNoYXIgYykgOiBoYXNobihudW0oYykpLCBoYXNocihudW0oYykpLCBjbnQoMSksIHByKHJhbmQoKSksIHJldigwKSwgdmFsKG51bShjKSksIGwoMCksIHIoMCl7fQp9ICpub2RlOwoK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