#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAXN = 2e5 + 5;
const ll BASE = 29, MOD = 1e9 + 7;
int num(char c){ return c - 'a' + 1; }
typedef struct nd{
ll hashn, hashr;
int cnt, pr, rev, 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);
if(t->l){
t->l->rev ^= 1;
if(t->l->rev) swap(t->l->hashn, t->l->hashr);
}
if(t->r){
t->r->rev ^= 1;
if(t->r->rev) swap(t->r->hashn, t->r->hashr);
}
t->rev = 0;
}
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; }
upd(l); upd(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; }
upd(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+Cgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKdHlwZWRlZiBsb25nIGxvbmcgbGw7CmNvbnN0IGludCBNQVhOID0gMmU1ICsgNTsKY29uc3QgbGwgQkFTRSA9IDI5LCBNT0QgPSAxZTkgKyA3OwoKaW50IG51bShjaGFyIGMpeyByZXR1cm4gYyAtICdhJyArIDE7IH0KCnR5cGVkZWYgc3RydWN0IG5kewoJbGwgaGFzaG4sIGhhc2hyOwoJaW50IGNudCwgcHIsIHJldiwgdmFsOwoJbmQgKmwsICpyOwoJbmQoY2hhciBjKSA6IGhhc2huKG51bShjKSksIGhhc2hyKG51bShjKSksIGNudCgxKSwgcHIocmFuZCgpKSwgcmV2KDApLCB2YWwobnVtKGMpKSwgbCgwKSwgcigwKXt9Cn0gKm5vZGU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