// I am soo weak :(
#include <bits/stdc++.h>
#include <vector>
using namespace std;
typedef long long ll;
#ifdef LOCAL
#include "debug.h"
#else
#define debug(...) 42
#define line() "author : AyazN";
#endif
#define all(x) (x).begin(), (x).end()
#define isz(x) (int)(x.size())
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
const int sz = 1000001, inf = 1000000000, LOG = 20;
const ll mod = 1000000007, INF = 1000000000000000000;
vector<int> divs[sz];
set<int> divNums;
int id[sz];
bool p[sz];
struct SegmentTree {
vector<int> st, a;
int n;
const int empty = 0;
int merge(int a, int b) {
if (a == 2) return a;
if (b == 2) return b;
return a + b;
}
void init(int _n, vector<int> A) {
n = _n;
st.resize((n<<2)|1);
a.resize(n + 1);
for (int i = 1; i <= n; i++) a[i] = A[i];
}
void build(int l, int r, int v) {
if (l == r) {
st[v] = a[l];
return;
}
int mid = (l + r)>>1;
build(l, mid, v<<1);
build(mid + 1, r, v<<1|1);
st[v] = merge(st[v<<1], st[v<<1|1]);
}
int getans(int ql, int qr, int l, int r, int v) {
if (ql > r || l > qr) return empty;
if (ql <= l && r <= qr) return st[v];
int mid = (l + r)>>1;
return merge(getans(ql, qr, l, mid, v<<1), getans(ql, qr, mid + 1, r, v<<1|1));
}
int getans(int l, int r) {
return getans(l, r, 1, n, 1);
}
void update(int l, int r, int pos, int val, int v) {
if (l > pos || pos > r) return;
if (l == r) {
st[v] ^= val;
return;
}
int mid = (l + r)>>1;
update(l, mid, pos, val, v<<1);
update(mid + 1, r, pos, val, v<<1|1);
st[v] = merge(st[v<<1], st[v<<1|1]);
}
void update(int pos, int val) {
update(1, n, pos, val, 1);
}
};
void run_case(int tc) {
int n, q; cin >> n >> q;
SegmentTree st[170];
for (int i = 0; i < 170; i++) st[i].init(n, vector<int>(n + 1, 0));
while (q--) {
char t; cin >> t;
if (t == 'S') {
int x; cin >> x;
for (auto i : divNums) {
if (x % i) continue;
auto u = id[i];
st[u].update(x, 1);
}
debug(divs[x]);
} else {
int l, r; cin >> l >> r;
auto ok = false;
for (auto d : divNums) {
if (st[id[d]].getans(l, r) >= 2) {
ok = true;
break;
}
}
cout << (ok ? "DA" : "NE") << '\n';
}
}
}
void precompute() {
divNums = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997};
int idFor = 0;
for (auto i : divNums) id[i] = idFor++;
}
signed main() {
#ifdef LOCAL
// freopen("err.log", "w", stderr);
#endif
precompute();
int t = 1; // cin >> t;
for (int tc = 1; tc <= t; tc++) {
run_case(tc);
}
}
/*
0:
0$P:
~~ wPPPI:
"~:~ .w$$$PI: .
v~++: w$$P$Pcc: ~~
!vv+::~ w$$$P$$cc: ~!~
. cIc::::~+X$$$PP$XIc~~!+"
. . ~. vcIo+:!+~w$$$$PP$PIIv~:+~
. . . "v vccI+:++!c$$$$$P$$$II:!+!:.. . .... .. . ..
.. .... . .. ......... ....!:!vcIo+++!~wPPPIc:!!+:~ ......... . . .. .
............................."::+coII+!!~"$$$w$$PPIIv!!:: !..............................................!!:v+coIII +!:cvPPIIv!!::~! ..................
............................!!:v+coIII~~~+!:cvPPIIv!!:: !..............................................!!:v+coIII +!:cvP$PoIv~!+!+~!...................
............................:!vv~coccv~vvcvcvcwPPPPII:~!:++"+...................
............................++:v"cI::cvvvvv+v:0$PI: !!:!!!...............................................:c!v:c!ccv::+++!!+0PI:~~!!:!!!...................
............................:c!v:c!ccv::+++!!+0PI: !!:!!!...............................................:c!v:c!ccv::+++!!+0P:!~~"!!!"++...................
..."....".............~"..+.:vo:vvc:X:!+!!!!!!0P$:++"~!"+~:v!.."....."..........
...."....."........."......++vIcovv:###w!!!!!!w0+!!!"~"~~+!+...".".........."...
."""......."...".$$"."""...!:ccIowv+!#!##!!!!!!!!!!!.~!~~v+"..."..""..........."
"""""."""""""".""$B"""..."".:wvoco++!o#0R#!!!!!!!!oPPP$":~~"".".""""."."""."".""
"""".""""""+cc+""..""..."$$."+:IccI"!~!!!$$!!!!+$R+$$"~!!!"~."..""""""."."""."""
""""""""+vcIo+"""""""""""$$$#.:co~co~!!!!!!!!!:vcI:~""+!~!~"""""".""""""""""""""
""""""":cwIo+.""""""""""~$$"+co" !! !!!!!!!!!!!". +v!!"""""""""""""""""""""""""""" Icow "+co"~!!~!!!!!!!!!!!".~+v!!"""""""""""""""""""""""
"""""~Icow"+co" !! !!!!!!!!!!!". +v!!"""""""""""""""""""""""""""" Icow$~"""@~""""..#$$#~"":cII.~"~!!!!!!!!+".:.::~"""""""""""""~"""""""""~
""""~occooI$$B""#$#""~".P:""""~"~!Ico"""~!!!!+!~.. v+!"""B"""""""""""""""~""""""
"""~~cccwc+BR~""R$$$"""""""""~"~:c"+co.""~"+~!. v:~""""".BB""~"~~"""~""""~"""""
"~"!vcccwc".~"""R$$$$$X""""~~"~PcI".+vc."""~. .~!~~""~""~w!!R.""""~"""""""!""~""
"""!!Icwo:""""+II$$$$!""""~0$o.""~:cI... !~"""~"":+:!!+!"!X""~"""~"""!v"""""
"""".."".~~"!IIIoo!#$$$"~"~wo$$"""""~~!~~"."~"""~$""~"$$~!~"""~~"~"~:c""~""~
"...""":+~"vIIIoIc~"PR@R@R@$~"."R#P~.~"""".. ".~~~v""@~~v~~~~~"c"~~~"~:c~~"~~~~
~..~~:!!~~cIIo: IIo:~~~IIo: $@@@$$v~~.+XX~.""""""".!" ~~"~~v~c"~~~~~cI+~~~~!II+!~"~~~~
"".".":II+$R$#!~~~~$$$#@@@$$0P!~!XXv!"~"""":!!. ~~~v!P~~~~~~~vo++~~~!Ioc+~~~~~~~
".~~.!~Ico$@B$$##B@@@@$#I00wXPPXv~~~"~o0!!~~.~~~~~~~~~~~!oo+:~~!Icc!+~"~~~~~
"~!!!~!I!":!$@@@@B@B@@@@@$0c0XPwXXXXXX~~+Xww+!!~~. "~~~~~~~~voI!!~~+occ!~~~~~~~+
+"!!..""~~::~@@@@@@@@@@@R$wIXPXXXPXXXPXPcw0w~!!!~... . .~~~~~..""""wwc++~"~~~:I~
~+!.""~~~"~P@@@@@@@@@@@@R$$0$#$$XXXXXXX0X00+!+!!"... .....vv"!~~~~~IoI!~"."!oc!~
"".~""~!+XXP#@@~:+o@@@@@@@@B$$$XXXXX00Xc00I++!!!...... . cI~!!!~~!:Ic~~"".oc~"~
"~.""~~~coXP:"~~":P@@@@@BB$$#$PXXXPXX0c000+++!!!.... ... vcI"!!!!!"!vv""~~::"~++
!!"."~~~~+."~"~"~.PRBBR#w$wXXXXXXXP00oXXX+++!!!..... . II"+~!~!!.c+:""~.!!+ww:
~!+:+.."~."""""".X0PXXX+0oXXP0P0P00XoXo0++:+!~!.........Ic!!~!!~.!!v~".""~Iow++~
"+!~:."~.~.".~"~I0XXXX~:!P0XXwXoX0oXcXo+!!+!~!".. ... :I~!!~!~~~"!~~".~~oI!!+~"
~!+!"~~~."..""..".!+v~~~"X0XXwXcXww0I0ov++~!!... ....c:~!!!!~!~"~~.!!!~~:o!!~""~
"!!"~~~""~..."~~~.~!!.~""o0Iw".$P$$0""~II!!!... ..cv~"!!~!!~!"~~""""~!!~w:~~""".
!."!!!"~~~~~~~~~~ "~"~"".v0""###$##$#wX"v:!!!+!!!!!~!!!+~+!~~"!.""..".v:I"""~~""
"~!!~+~~~~~~~~~"~".".".++c..""$##$#P$ww""+!!!!!!!!~!!!!"~!~.~"~."~."~!:~""."""..
*/