#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 ;
///////////////////////////////////////////////
int bankai[sz] ;
vector<int>spf(sz , 1) ;
void f() {
spf[0] = 0 ;
for(int i = 2 ; i < sz ; i ++) {
if(spf[i] == 1) {
for(int j = i ; j < sz ; j += i) {
if(spf[j] == 1) {
spf[j] = i ;
}
}
}
}
}
void get(int n , vector<int>&a) {
while(n > 1) {
if(spf[n] > 1)a.pb(spf[n]) ;
n /= spf[n] ;
}
}
///////////////////////////////////////////////
void solve() {
f() ;
int n ;
cin >> n ;
int m ;
cin >> m ;
int cnt = 0 ;
vector<bool>a(n + 1 , 0) ;
while(m --) {
char ch ;
cin >> ch ;
if(ch == 'S') {
int target ;
cin >> target ;
if(a[target] == 0) {
vector<int>divs ;
//cout << "0000000" << endl ;
get(target , divs) ;
for(int i : divs) {
//cout << i << ' ' ;
bankai[i] ++ ;
if(bankai[i] > 1) {
cnt ++ ;
}
}
a[target] = 1 ;
//cout << endl ;
}
else {
vector<int>divs ;
//cout << "1111111" << endl ;
get(target , divs) ;
for(int i : divs) {
//cout << i << ' ' ;
bankai[i] -- ;
if(bankai[i] <= 1) {
cnt -- ;
}
}
a[target] = 0 ;
//cout << endl ;
}
}
else{
int l , r ;
cin >> l >> r ;
bool b = false ;
//cout << cnt << ' ' ;
if(cnt > 0) b = true ;
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 ;
}
}