#include <bits/stdc++.h>
using namespace std;
///////////////////////////////////////////////
#define int long long
#define endl "\n"
#define IO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define INF 0x3F3F3F3F3F3F3F3F
#define ss second
#define ff first
#define pb push_back
#define ins insert
#define all(a) a.begin() , a.end()
#define input(a , n) for(int i = 0 ; i < n ; i ++) cin >> a[i]
///////////////////////////////////////////////
const int sz = 5e5 + 5 ;
const int LG = 20 ;
const int N = 1e8 ;
const int mod = 1e9 + 7 ;
const int MAXM = 1e9 + 7 ;
///////////////////////////////////////////////
///////////////////////////////////////////////
void solve() {
int n ;
cin >> n ;
int m ;
cin >> m ;
if(n <= 100 and m <= 200) {
vector<bool>a(n + 1 , 0) ;
int cnt = 0 ;
while(m --) {
char ch ;
cin >> ch ;
if(ch == 'S') {
int target ;
cin >> target ;
if(a[target] == 1) a[target] = 0 , cnt -- ;
else a[target] = 1 , cnt ++ ;
}
else{
int l , r ;
cin >> l >> r ;
bool b = false ;
for(int i = l ; i <= r ; i ++) {
if(b == true) break ;
if(a[i] == 1) {
for(int j = i + 1 ; j <= r ; j ++) {
if(a[j] == 1) {
if(gcd(i , j) > 1) {
b = true ;
break ;
}
}
}
}
}
if(b == true) {
cout << "DA" << endl ;
continue ;
}
else {
cout << "NE" << endl ;
continue ;
}
}
}
}
else{
vector<bool>a(n + 1 , 0) ;
int cnt = 0 ;
while(m --) {
char ch ;
cin >> ch ;
if(ch == 'S') {
int target ;
cin >> target ;
if(a[target] == 1) a[target] = 0 ;
else a[target] = 1 ;
}
else{
int l , r ;
cin >> l >> r ;
bool b = false ;
for(int i = 2 ; i <= n ; i ++) {
if(b == true) break ;
if(a[i] == 0) continue ;
for(int j = i + i ; j <= n ; j += i) {
if(a[j] == 1) {
b = true ;
break ;
}
}
}
if(b == true) {
cout << "DA" << endl ;
continue ;
}
else {
cout << "NE" << endl ;
continue ;
}
}
}
}
}
///////////////////////////////////////////////
///////////////////////////////////////////////
signed main() {
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
IO ;
int t = 1 ; // cin >> t ;
while(t --) {
solve() ;
cout << endl ;
}
}