
In Croatia there are radio stations. Each station has a concession on one of
frequencies denoted by positive integers from
to
. The frequencies were not chosen
ideally so sometimes noise appears when multiple stations are broadcasting at the same
time. To be more precise, if two radio stations, with frequencies
and
respectively, are
broadcasting at the same time, noise will appear if
and
are not relatively prime. The
listeners, of course, do not like the noise, so when they hear it they switch to another
station.
To solve this noise problem, the radio station owners are asking you to write a program which simulates the actions of the radio stations. Your program needs to support two types of queries:
S x
: If not currently broadcasting, the station with frequencystarts broadcasting, and if it is already broadcasting, it stops.
C l r
: Check if there exists a pair of broadcasting stations whose frequenciesand
are from the interval
and such that
. If such a pair exists, print
DA
, otherwise printNE
.
Initially, no station is broadcasting.
Input Specification
The first line contains positive integers and
, the number of
radio stations (and frequencies), and the number of queries, respectively.
The of the next
lines contains a description of the
query. For queries of the first type it will
hold that
, and for queries of the second type it will hold that
.
Output Specification
Print the answers to the queries of the second type in order, in separate lines.
Constraints
Subtask | Points | Constraints |
---|---|---|
For all queries of the second type it holds that | ||
Sample Input 1
6 8
S 1
S 2
S 3
C 1 6
S 6
C 1 6
S 2
C 1 6
Sample Output 1
NE
DA
DA
Explanation for Sample Output 1
The stations broadcasting during the first C
type query are ,
and
. These numbers are all relatively
prime to each other so they create no noise. Once station
begins to broadcast, it creates noise with
stations
and
. After station
stops broadcasting the noise with station
persists.
Sample Input 2
11 6
S 4
S 10
C 3 11
C 2 7
S 6
C 2 7
Sample Output 2
DA
NE
DA
Sample Input 3
20 7
S 10
S 15
S 3
C 10 15
S 10
C 3 15
C 3 10
Sample Output 3
DA
DA
NE
Comments